Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/arrays/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
存在0时,php数组偏移量为0_Php_Arrays - Fatal编程技术网

存在0时,php数组偏移量为0

存在0时,php数组偏移量为0,php,arrays,Php,Arrays,当我回音 print_r(array_values(array_filter($exampleArray[5]["Numbers"]))); 我得到一个数组,看起来像 Array ( [0] => 100 [1] => 31 [2] => 023 ) 但当我附和这句话的时候 print_r(array_values(array_filter($exampleArray[5]["Numbers"][0]))); 我明白了 Notice:

当我回音

print_r(array_values(array_filter($exampleArray[5]["Numbers"])));
我得到一个数组,看起来像

Array ( [0] => 100 
        [1] => 31 
        [2] => 023 )
但当我附和这句话的时候

print_r(array_values(array_filter($exampleArray[5]["Numbers"][0])));
我明白了

Notice: Undefined offset: 0 
Warning: array_filter() expects parameter 1 to be array, null given
Warning: array_values() expects parameter 1 to be array, null given
信息。
显然有一个0索引,但我不知道为什么会出错。

就这么简单,
$exampleArray[5][“Numbers”][0]
不是数组,而是字符串

如果要获取索引
[0]
值,应在
array\u values
响应中调用index
0

print_r(array_values(array_filter($exampleArray[5]["Numbers"]))[0]);

上面的代码将返回
100

简单,因为
$exampleArray[5][“Numbers”][0]
不是数组,而是字符串

如果要获取索引
[0]
值,应在
array\u values
响应中调用index
0

print_r(array_values(array_filter($exampleArray[5]["Numbers"]))[0]);
上述代码将返回
100