Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/244.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
Php “收到通知”;“数组到字符串的转换”;使用call_user_func_array()时_Php_Arrays - Fatal编程技术网

Php “收到通知”;“数组到字符串的转换”;使用call_user_func_array()时

Php “收到通知”;“数组到字符串的转换”;使用call_user_func_array()时,php,arrays,Php,Arrays,我想检查多个数组中是否有匹配的值,所以我将它们放入$array中,创建了一个多维数组,然后编写了这行代码: $result = call_user_func_array('array_intersect', $array); Notice: Array to string conversion 我得到了我想要的结果,但我总是在特定的代码行上得到这样的通知: $result = call_user_func_array('array_intersect', $array); Notice:

我想检查多个数组中是否有匹配的值,所以我将它们放入
$array
中,创建了一个多维数组,然后编写了这行代码:

$result = call_user_func_array('array_intersect', $array);
Notice: Array to string conversion
我得到了我想要的结果,但我总是在特定的代码行上得到这样的通知:

$result = call_user_func_array('array_intersect', $array);
Notice: Array to string conversion
想知道是什么原因造成的。希望有人能启发我。

你的数组(在
$array
中的第一级项目)本身包含数组。这不受支持,因为它将数组项视为字符串以确定相等性:

注:当且仅当
(string)$elem1==(string)$elem2
时,两个元素被视为相等。 换句话说:当字符串表示形式相同时

如果不知道您想做什么,我不能肯定地说,但是一个可能的解决方案是使用它,它将允许您在代码中指定如何比较项目,而不必将它们转换为字符串。

您的数组(在
$array
中的第一级项目)本身包含数组。这不受支持,因为它将数组项视为字符串以确定相等性:

注:当且仅当
(string)$elem1==(string)$elem2
时,两个元素被视为相等。 换句话说:当字符串表示形式相同时

如果不知道您要做什么,我不能肯定地说,但是一个可能的解决方案是使用它,它将允许您在代码中指定如何比较项,而不必将它们转换为字符串