【发布时间】:2014-05-15 15:36:30
【问题描述】:
我有一个数组数组。例如
$value= array(
['global'] => array('1'=>'amar'),
['others'] => array('1' => 'johnson')
);
我的问题是如何只打印第二个数组。我知道我可以使用 print $value['others'] 进行打印,但我的问题是其他值可能会改变。它可能是['blah1'], ['blah2']。所以我需要一行 php 代码来回显第二个数组 print $value['others'] ,其中其他可能是不同的词。
我的新数组也应该是这样的 $value= array(['others'] => array('1' => 'johnson'));
谢谢
【问题讨论】:
-
试试这样的递归函数:stackoverflow.com/questions/4719326/…
-
试试 print_r($value['others']) ?
-
如果您事先不知道密钥的名称,则必须首先确定要处理的密钥。