Home >Backend Development >PHP Tutorial >Two ways to merge two arrays in PHP
Output results: The first situation Array ( [0] => 1 [1] => 2 [2] => 3 [3] => 4 [4] => 5 [5] => 6 [6] => 7 [7] => 8 [8] => 9 ) Array ( [0] => 1 [1] => 2 [2] => 3 [3] => 4 [4] => 5 [5] => 6 ) Array ( [0] => 7 [1] => 8 [2] => 9 [3] => 4 [4] => 5 [5] => 6 ) Second case Array ( [0] => a [1] => b [2] => c [3] => d [4] =>e [5] => f [6] => a [7] => x [8] => y ) Array ( [0] => a [1] => b [2] => c [3] => d [4] =>e [5] => f ) Array ( [0] => a [1] => x [2] => y [3] => d [4] =>e [5] => f ) The third situation Array ( [0] => a [1] => b [2] => c [3] => d [4] =>e [5] => f [6] => a [7] => x [8] => y ) Array ( [1] => a [2] => b [3] => c [4] => d [5] =>e [6] => f [7] => x [8] => y ) Array ( [1] => a [7] => x [8] => y [2] => b [3] => c [4] => d [5] =>e [6] => f ) |