What's wrong with this array merge?
$array_az = range('a', 'z');
$array_AZ = range('A', 'Z');
$array_09 = range(0, 9);
array_merge($array_az, $array_AZ, $array_09);
print_r($array_az); // a, b, c ... z, 0, 1 ...
But I want something like: // a, b, c, ... z, A, B, C, ... Z, 0, 1 ...
How could I get this output? Thank you.
array_merge
returns the merged result, which means you need to store it.
$merged_array = array_merge($array_az, $array_AZ, $array_09);
print_r($merged_array);
array_merge returns the resulting array. You should be saving the result
$merged = array_merge($array_az, $array_AZ, $array_09);
array_merge
returns a new array and does not act on an array by reference. Try the following:
$array_az = array_merge($array_az, $array_AZ, $array_09);
$array_az
will now contain your desired result.
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.