Array values, solving
PHP Code
$uc =; $WC = Getu_province (); foreach ($wc as $k = + $v) { $uv = $v [' $uc ']; $prolist = Join (' 0010 '. $uc); foreach ($uv as $s = + $a) { if ($a [0]= $prolist) { $ucc = $a [' $prolist ']; } }
$WC something like this array ([0] = = Array ([001011] [+] = Beijing) [1] = = Array ([001012] = Tianjin) [2] = = Array ([001013] (Hebei) ...)
Need to take 001033 of the Chinese value,,,, how to take? It seems that the above is not very right to say;
------Solution--------------------
Is the 0010 fixed? I don't really understand your code.
PHP code
$testArray = Array (' 001011 ' = ' = ' Beijing '), Array (' 001012 ' = ' Tianjin '), Array (' 001013 ' = ' Hebei ');//$WC = Getu_province (); $uc = n; $find = ' 0010 '. $uc; foreach ($testArray A S $value) {if (Array_key_exists ($find, $value)) {echo ' region: '. $value [$find]; Break }}
------solution--------------------
$uv = $v [' $uc '];
and
$uv = $v ["$uc"];
is not the same.
------Solution--------------------
$uc = 1,
"$uc" is "1", and
' $uc ' is the string "$uc"
because in double quotes, the variable name is replaced by the value of the variable. Then it will be sent to the browser, and the single quotes will not.
------Solution--------------------
Explore
Test OK!!
by the way $v[$uc]//$v [' $UC ']//$v ["$uc"]; three differences!