Array_combine when used, the key name would like to show only one, how to display all.
$sum =array ([0] = 0 [1] = 0 [2] = 0 [3] = 0 [4] = [5] = [6] = 0 [7] = 0 [8] = 1 5 [9] = 15)
$city =array ([0] = Nanchang [1] = Ganzhou [2] = [3] = Jiujiang [4] = Nanchang [5] = = Jiujiang [6] = Pingxiang [7] = [8] = Nanchang [9] = Jiujiang)
$arra 1=array_combine ($sum, $city);
The results are as follows.
Array ([0] = outside the province [[+] = Nanchang [] = Jiujiang)
The system will only show one of the same key names ...
Is there any way to let him show it all out.
is to fully display the key name and key value.
displayed as array ([0] = Nanchang [0] = Ganzhou [0] = [0] = Jiujiang [+] = Nanchang [] = Jiujiang [0] = Pingxiang [0] = [15] = Nanchang [+] = Jiujiang)
is to make the key value of the first array the key name of the second array,
Share to:
------Solution--------------------
Can the key name be repeated?
------Solution--------------------
$arr =array_combine ($city, $sum);
Echo ' Array (', php_eol;
foreach ($arr as $k = $v) echo "\t[$v]=> $k", Php_eol;
Echo ') ', php_eol;
Display complete, pure entertainment ...
------Solution--------------------
Your array does not exist, the same key value of the same dimension cannot appear more than two.