Req #55853 [Opn->Wfx]: provide an array_diff equivalent for undetermined numbers of array
Edit report at https://bugs.php.net/bug.php?id=55853&edit=1
ID: 55853
Updated by: nikic@php.net
Reported by: netmosfera at gmail dot com
Summary: provide an array_diff equivalent for undetermined
numbers of array
-Status: Open
+Status: Wont fix
Type: Feature/Change Request
Package: Arrays related
Operating System: irrelevant
PHP Version: Irrelevant
Block user comment: N
Private report: N
New Comment:
You can already do this using call_user_func_array:
$diff = call_user_func_array('array_diff', $arrays);
Previous Comments:
------------------------------------------------------------------------
[2011-12-30 05:02:21] phristen at yahoo dot com
I agree, BUT this is opening a big can of worms because there are plenty other functions that could
use the same treatment, like array_merge and the likes.
------------------------------------------------------------------------
[2011-10-05 17:32:53] netmosfera at gmail dot com
Description:
------------
hi
if I have an undetermined number of array I can't use array_diff to get the differences
a function like: array_diff_array() would be really nice
<?php
$myarrays[] = array("a" => "green", "red", "blue",
"red");
$myarrays[] = array("b" => "green", "yellow", "red");
// undetermined number of arrays
print_r(array_diff_array($myarrays));
?>
I think that the only way to do this now, is using eval!
thank you!
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=55853&edit=1
Thread (3 messages)