IN PHP i have the following arrays.
And i have this array:
What i want to do is append the second array to the first one, i tried doing it like so:
end($array1);
foreach($array2 as $key => $value ){
$array1[$key] = $value;
}
With this result:
My question is; How do i put the the values and keys of the second array into the first one?
Answer: due to the answer of Manikiran i now got the following array as a result:
array_merge() is the function you are looking for. Try the following code:
$new_array=array_merge($array1,$array2);
For more information, check out the manual
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.