Doc #77487 [Opn->Nab]: array_diff_assoc
| From: | requinix@php.net | Date: | Fri, 18 Jan 2019 21:07:42 +0000 |
| Subject: | Doc #77487 [Opn->Nab]: array_diff_assoc | ||
| References: | 1 | Groups: | php.doc.bugs |
| Request: | Send a blank email to doc-bugs+get-16342@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=77487&edit=1
ID: 77487
Updated by: requinix@php.net
Reported by: felipegryllo at gmail dot com
Summary: array_diff_assoc
-Status: Open
+Status: Not a bug
Type: Documentation Problem
Package: *General Issues
PHP Version: 5.6.40
Block user comment: N
Private report: N
New Comment:
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php
Now that you've read the description, read the return values section.
> Returns an array containing all the values from array1 that are not present in any of the other
> arrays.
Previous Comments:
------------------------------------------------------------------------
[2019-01-18 21:05:34] felipegryllo at gmail dot com
Description:
------------
Hello, everyone!
Please, check this description:
"Two values from key => value pairs are considered equal only if (string) $elem1 ===
(string) $elem2 . In other words a strict check takes place so the string representations must be
the same."
But this example say:
<?php
$array1 = array(0, 1, 2);
$array2 = array("00", "01", "2");
$result = array_diff_assoc($array1, $array2);
print_r($result);
?>
Returns:
Array
(
[0] => 0
[1] => 1
)
See it: "are considered equal only if (string) $elem1 === (string) $elem2"
if (2 === "2")
It's false! But this function return like equals...
Thanks, so mutch!
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=77487&edit=1