I feel like I haven't written an article for a long time. Recently, the pressure is huge. Let's talk about php arrays today. for example, I have two arrays. The format is as follows:
I feel like I haven't written an article for a long time. Recently, the pressure is huge. Let's talk about php arrays today. for example, I have two arrays. The format is as follows:
$ List = array ('1' => 'A', '2' => 'B', '3' => 'C ');
$ List2 = array ('1' => '1', '2' => '2', '3' => '3 ');
Array (3 ){
[1] =>
String (1) ""
[2] =>
String (1) "B"
[3] =>
String (1) "c"
}
Array (3 ){
[1] =>
String (1) "1"
[2] =>
String (1) "2"
[3] =>
String (1) "3"
}
So how do I want him to make up this format?
Array (6 ){
[0] =>
String (1) ""
[1] =>
String (1) "1"
[2] =>
String (1) "B"
[3] =>
String (1) "2"
[4] =>
String (1) "c"
[5] =>
String (1) "3"
}
I don't know if you have encountered this problem in the project. First, let's look at the implementation code:
$ List = array ('1' => 'A', '2' => 'B', '3' => 'C ');
$ List2 = array ('1' => '1', '2' => '2', '3' => '3 ');
Var_dump ($ list );
Var_dump ($ list2 );
$ Size = count ($ list)> count ($ list2 )? Count ($ list): count ($ list2); // retrieves the array loop with the most elements
$ Arr = array ();
For ($ I = 1; $ I <= $ size; $ I ++ ){
Array_push ($ arr, $ list [$ I]); // Press the array into a new variable.
Array_push ($ arr, $ list2 [$ I]); // Press the array into a new variable.
}
Var_dump ($ arr );
?>
OK.