- $ Array1 = array ("A", "B", "C", "D ");
- $ Array2 = array ("1", "2", "3", "4 ");
- $ Array3 = array ("! "," @ "," # "," $ ");
- $ ArrayX = array_merge ($ array1, $ array2, $ array3); // combine the three numbers
- Print_r ($ arrayX );
- ?>
Example 2: php array merge.
- $ Array1 = array ("AA" => "A", "BB" => "B", "CC" => "C ", "DD" => "D ");
- $ Array2 = array ("AA" => "1", "BB" => "2", "CC" => "3 ", "DD" => "4 ");
- $ Array3 = array ("AA" => "! "," BB "=>" @ "," CC "=>" # "," DD "=>" $ ");
- $ ArrayX = array_merge ($ array1, $ array2, $ array3); // merge arrays
- Print_r ($ arrayX );
- ?>
Example 3: php array merge.
- // By bbs.it-home.org
- $ Array1 = array ("AA" => "A", "BB" => "B", "CC" => "C ", "DD" => "D ");
- $ Array2 = array ("AA" => "1", "BB" => "2", "CC" => "3 ", "DD" => "4 ");
- $ Array3 = array ("AA" => "! "," BB "=>" @ "," CC "=>" # "," DD "=>" $ ");
- $ ArrayX = array_merge_recursive ($ array1, $ array2, $ array3); // merge arrays
- Print_r ($ arrayX );
- ?>
Example 4: php array split.
- $ Array = array (1, 2, 3, 4, 5, 6, 7, 8, 9 );
- $ ArrayX = array_splice ($ array, 2, 6); // Obtain 2nd to 7th elements of the array.
- Print_r ($ array );
- Print_r ($ arrayX );
- ?>
>>> Articles you may be interested in: PHP array split and array join php chunk function split array instance php mb_chunk_split function support wide character split php space split text as an array example php simple example of splitting Chinese strings into arrays php split Chinese and English strings several methods of php split () application example of string splitting function php solution of GBK Chinese garbled characters php example of string splitting function of explode php array merging Example code PHP merge two arrays two methods of php merge arrays by classification php array operation instance merging array php array merging, append and connection method (array_merge (), array_combine () function) examples of php array merging and recursive merging php array merging instance learning |