-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Closed as not planned
Labels
Description
Description
The following code:
on php8.x
<?php
$array1 = array("111" => ["color" => "green"]);
$array2 = array("111" => ["color" => "green"]);
$result = array_diff_assoc($array1, $array2);
print_r($result);
Resulted in this output:
Warning: Array to string conversion in script on line 4
Warning: Array to string conversion in script on line 4
Array
(
)
But I expected this output instead:
Array
(
)
on php7.4
<?php
$array1 = array("111" => ["color" => "green"]);
$array2 = array("111" => ["color" => "green"]);
$result = array_diff_assoc($array1, $array2);
print_r($result);
Resulted in this output:
Array
(
)
期待结果为:无论那个版本,当比较数组一致时,比较不应该报错,输出位空数组即可
Expect the result to be: no matter which version, when the comparison array is consistent, the comparison should not report an error, and the output bit empty array can be
PHP Version
PHP 8.x
Operating System
windows or linux