我有一个返回的数组:
Array
(
[] => Array
(
[first_name] => Charles
[last_name] => Darwin
[title] => 1
[academic_unit] => 2
)
)
我想得到第二个数组。我怎么能这样做?
答案 0 :(得分:1)
您可以像这样访问它
$array[null]['first_name']
//or this which saves you a cast from null to an empty string
$array['']['first_name']
" [] =>阵列"表示索引是空字符串
null
将内部转换为空字符串
$array = array(null => array('hello'));
print_r($array);
结果
Array
(
[] => Array
(
[0] => hello
)
)
来自文档:"此外,还会发生以下关键演员" http://php.net/manual/en/language.types.array.php
Null将被转换为空字符串,即键空值实际上将存储在""。