Appending arrays in PHP can be done with the array_merge() function. The array will take any number of arrays as arguments and will return a single array. Here is an example using just two arrays.
Will print out.
Array ( [0] => item1 [1] => item2 [2] => item3 [3] => item4 )
You can also create arrays using the array command inside the parameter list.
Array ( [0] => item1 [1] => item2 [2] => item3 [3] => item4 [4] => item5 [5] => item6 )
Array ( [0] => item1 )
Array ( [item1] => item5 [item2] => item6 )
0 comments:
Post a Comment