This article describes the method of php combining associative and non-associative arrays through the array_merge() function. Share it for your reference. The specific analysis is as follows:
array_merge() is a php function for merging arrays. The latter array is appended to the end position of the previous one and returns the merged result array.
<?php $beginning = 'foo'; $end = array(1 => 'bar'); $result = array_merge((array)$beginning, (array)$end); print_r($result); ?>
The output result is as follows:
Array ( [0] => foo [1] => bar )
I hope this article will be helpful to everyone's PHP programming.