Php concat 2 array


Definition and Usage

The array_merge() function merges one or more arrays into lớn one array.

Bạn đang xem: Php concat 2 array

Tip: You can assign one array khổng lồ the function, or as many as you lượt thích.

Note: If two or more array elements have the same key, the last one overrides the others.

Note: If you assign only one array to the array_merge() function, & the keys are integers, the function returns a new array with integer keys starting at 0 & increases by 1 for each value (See example below).

Xem thêm: Cách Làm Thịt Xíu Miền Trung Của Thanh Le Thi Bich, Cách Làm Món Ngon Thịt Xá Xíu Của Người Quảng Nam

Tip: The difference between this function & the array_merge_recursive() function is when two or more array elements have the same key. Instead of override the keys, the array_merge_recursive() function makes the value as an array.

Syntax


array_merge(array1, array2, array3, ...)

Parameter Values

Parameter Description array1 Required. Specifies an array array2 Optional. Specifies an array array3,... Optional. Specifies an array

Technical Details

Return Value: Returns the merged array PHPhường. Version: 4+ Changelog: As of PHP 5.0, this function only accept parameters of type array

More Examples


Example

Merge two associative arrays inkhổng lồ one array:


"red","b"=>"green"); $a2=array("c"=>"blue","b"=>"yellow"); print_r(array_merge($a1,$a2));?>
Try it Yourself »

Example

Using only one array parameter with integer keys:


"red",4=>"green"); print_r(array_merge($a));?>
Try it Yourself »
❮ PHPhường. Array Reference
COLOR PICKER
*

LIKE US

Get certifiedby completinga course today!


obatambeienwasirherbal.com CERTIFIED . 2021
Get started
CODE GAME
*

Play Game


Certificates
HTML CSS JavaScript Front End Pykhông lớn Squốc lộ And more
REPORT ERROR
FORUM
ABOUT
SHOP..
×

Report Error

If you want lớn report an error, or if you want lớn make a suggestion, vị not hesitate to skết thúc us an e-mail:

help
obatambeienwasirherbal.com


×

Thank You For Helping Us!

Your message has been sent lớn obatambeienwasirherbal.com.


Top Tutorials HTML Tutorial CSS Tutorial JavaScript Tutorial How To Tutorial SQL Tutorial Pythanh mảnh Tutorial W3.CSS Tutorial Bootstrap Tutorial PHP. Tutorial Java Tutorial C++ Tutorial jQuery Tutorial
Top References HTML Reference CSS Reference JavaScript Reference Squốc lộ Reference Pynhỏ nhắn Reference W3.CSS Reference Bootstrap Reference PHPhường Reference HTML Colors Java Reference Angular Reference jQuery Reference
Top Examples HTML Examples CSS Examples JavaScript Examples How To Examples SQL Examples Pynhỏ bé Examples W3.CSS Examples Bootstrap Examples PHPhường. Examples Java Examples XML Examples jQuery Examples
Web Courses HTML Course CSS Course JavaScript Course Front End Course SQL Course Pyhạn hẹp Course PHPhường Course jQuery Course Java Course C++ Course C# Course XML Course Get Certified »
obatambeienwasirherbal.com is optimized for learning và training. Examples might be simplified lớn improve sầu reading và learning. Tutorials, references, and examples are constantly reviewed lớn avoid errors, but we cannot warrant full correctness of all content. While using obatambeienwasirherbal.com, you agree to lớn have read & accepted our terms of use, cookie & privacy policy. Copyright 1999-2021 by Refsnes Data. All Rights Reserved. obatambeienwasirherbal.com is Powered by W3.CSS.
*