1--TEST-- 2basic array_combine test 3--FILE-- 4<?php 5$array1 = array('green', 'red', 'yellow'); 6$array2 = array('1', '2', '3'); 7$array3 = array(0, 1, 2); 8$array4 = array(TRUE, FALSE, NULL); 9$a = array_combine($array1, $array1); 10$b = array_combine($array1, $array2); 11$c = array_combine($array1, $array3); 12$d = array_combine($array1, $array4); 13$e = array_combine($array2, $array1); 14$f = array_combine($array2, $array2); 15$g = array_combine($array2, $array3); 16$h = array_combine($array2, $array4); 17$i = array_combine($array3, $array1); 18$j = array_combine($array3, $array2); 19$k = array_combine($array3, $array3); 20$l = array_combine($array3, $array4); 21$m = array_combine($array4, $array1); 22$n = array_combine($array4, $array2); 23$o = array_combine($array4, $array3); 24$p = array_combine($array4, $array4); 25 26$letters = range('a', 'p'); 27foreach ($letters as $letter) { 28 var_dump($$letter); 29} 30?> 31--EXPECT-- 32array(3) { 33 ["green"]=> 34 string(5) "green" 35 ["red"]=> 36 string(3) "red" 37 ["yellow"]=> 38 string(6) "yellow" 39} 40array(3) { 41 ["green"]=> 42 string(1) "1" 43 ["red"]=> 44 string(1) "2" 45 ["yellow"]=> 46 string(1) "3" 47} 48array(3) { 49 ["green"]=> 50 int(0) 51 ["red"]=> 52 int(1) 53 ["yellow"]=> 54 int(2) 55} 56array(3) { 57 ["green"]=> 58 bool(true) 59 ["red"]=> 60 bool(false) 61 ["yellow"]=> 62 NULL 63} 64array(3) { 65 [1]=> 66 string(5) "green" 67 [2]=> 68 string(3) "red" 69 [3]=> 70 string(6) "yellow" 71} 72array(3) { 73 [1]=> 74 string(1) "1" 75 [2]=> 76 string(1) "2" 77 [3]=> 78 string(1) "3" 79} 80array(3) { 81 [1]=> 82 int(0) 83 [2]=> 84 int(1) 85 [3]=> 86 int(2) 87} 88array(3) { 89 [1]=> 90 bool(true) 91 [2]=> 92 bool(false) 93 [3]=> 94 NULL 95} 96array(3) { 97 [0]=> 98 string(5) "green" 99 [1]=> 100 string(3) "red" 101 [2]=> 102 string(6) "yellow" 103} 104array(3) { 105 [0]=> 106 string(1) "1" 107 [1]=> 108 string(1) "2" 109 [2]=> 110 string(1) "3" 111} 112array(3) { 113 [0]=> 114 int(0) 115 [1]=> 116 int(1) 117 [2]=> 118 int(2) 119} 120array(3) { 121 [0]=> 122 bool(true) 123 [1]=> 124 bool(false) 125 [2]=> 126 NULL 127} 128array(2) { 129 [1]=> 130 string(5) "green" 131 [""]=> 132 string(6) "yellow" 133} 134array(2) { 135 [1]=> 136 string(1) "1" 137 [""]=> 138 string(1) "3" 139} 140array(2) { 141 [1]=> 142 int(0) 143 [""]=> 144 int(2) 145} 146array(2) { 147 [1]=> 148 bool(true) 149 [""]=> 150 NULL 151} 152