Req #79890 [Opn->Dup]: array_unique does not allow strict comparison
Edit report at https://bugs.php.net/bug.php?id=79890&edit=1
ID: 79890
Updated by: nikic@php.net
Reported by: michael dot vorisek at email dot cz
Summary: array_unique does not allow strict comparison
-Status: Open
+Status: Duplicate
Type: Feature/Change Request
Package: Scripting Engine problem
Operating System: any
PHP Version: 7.4.8
Block user comment: N
Private report: N
New Comment:
Duplicate of bug #65208.
Previous Comments:
------------------------------------------------------------------------
[2020-07-23 15:26:51] michael dot vorisek at email dot cz
Description:
------------
this should be definitely supported, probably with SORT_UNIQUE_STRICT constant.
currently, there is not simple way to remove same instance duplicates
Test script:
---------------
$d = new \DateTime('2000-1-1');
print_r(
array_unique([$d, $d, new \DateTime('2000-1-1')], SORT_REGULAR)
);
Expected result:
----------------
array with 2 DateTime elements
Actual result:
--------------
remove same instance duplicates - not supported by array_unique
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=79890&edit=1
Thread (2 messages)