I have a person array, with a key n for name. The value for n is an array, with key l (short for last ) having the value I want to get at, the last name.
出于奇怪的方案拟订原因,我用最后名称“地址”作为string。
How do I do this?
I ve tried eval, among others.
共和国 我是清楚的!
我想要的是利用变数的测试获得。
例如:
$person[$test]
(显然没有工作,但又做了些什么?)
<?php
$test = "[ n ][ l ]";
echo "I ve got a string with the array index ".$test. "
";
$person = array("n"=>array( l => SMITH ));
echo the array, $person, is this: ."
";
print_r($person);
echo "What I want is ".$person[ n ][ l ]. "
";
?>
Output:
I ve got a string with the array index [ n ][ l ] the array, $person, is this: Array ( [n] => Array ( [l] => SMITH ) )
我想的是SMITH。