Doc #69555 [Fbk->Asn]: unpredictable results with array_udiff example
| From: | buero at wehrstedt dot com | Date: | Thu, 30 Apr 2015 22:13:15 +0000 |
| Subject: | Doc #69555 [Fbk->Asn]: unpredictable results with array_udiff example | ||
| References: | 1 | Groups: | php.doc.bugs |
| Request: | Send a blank email to doc-bugs+get-12278@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=69555&edit=1
ID: 69555
User updated by: buero at wehrstedt dot com
Reported by: buero at wehrstedt dot com
Summary: unpredictable results with array_udiff example
-Status: Feedback
+Status: Assigned
Type: Documentation Problem
Package: Arrays related
Operating System: XAMPP
PHP Version: 5.4Git-2015-04-30 (Git)
Assigned To: cmb
Block user comment: N
Private report: N
New Comment:
In the German Manual, there is no example #2, there is just one.
I meant this:
function comp_func_cr($a, $b)
{
if ($a->priv_member === $b->priv_member) return 0;
return ($a->priv_member > $b->priv_member)? 1:-1;
}
Previous Comments:
------------------------------------------------------------------------
[2015-04-30 20:13:41] cmb@php.net
To which example are you referring to? Example#2 uses $a == $b,
what is correct, because DateTime instances are compared.
------------------------------------------------------------------------
[2015-04-30 19:35:26] buero at wehrstedt dot com
Description:
------------
---
From manual page: http://www.php.net/function.array-udiff
---
I tried out the example shown with function array_udiff. The example sets a property in the cr
class, the compare function compares boolena instead of numerical.
I tried this example; as soon as I changed to $a == $b instead of $a === $b, I've got the
results I exspected.
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=69555&edit=1