Req #53170 [Opn->Wfx]: Cannot substract Arrays
| From: | cmb@php.net | Date: | Tue, 08 Jun 2021 14:33:32 +0000 |
| Subject: | Req #53170 [Opn->Wfx]: Cannot substract Arrays | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-234267@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=53170&edit=1
ID: 53170
Updated by: cmb@php.net
Reported by: gmblar+php at gmail dot com
Summary: Cannot substract Arrays
-Status: Open
+Status: Wont fix
Type: Feature/Change Request
Package: Arrays related
Operating System: Linux
PHP Version: 5.3.3
-Assigned To:
+Assigned To: cmb
Block user comment: N
Private report: N
New Comment:
Well, some may want - to behave like array_diff(), others as
array_diff_assoc(), and others as array_diff_key(). I'm not even
sure which one I'd prefer, but I'm fine with being explicit, and
rather avoid thinking about it.
If you stll feel this would be a valuable addition to PHP, please
pursue the RFC process[1].
[1] <https://wiki.php.net/rfc/howto>
Previous Comments:
------------------------------------------------------------------------
[2010-10-26 20:16:47] gmblar+php at gmail dot com
Expect same behavior as array_diff() http://de.php.net/manual/en/function.array-
diff.php
------------------------------------------------------------------------
[2010-10-26 17:37:21] gmblar+php at gmail dot com
Description:
------------
Add is supported but substract Arrays not
Test script:
---------------
<?php
$foo = array('a' => 1, 'b' => 2);
$bar = array('c' => 3, 'd' => 4);
$foobar = $foo + $bar;
print_r($foobar);
$foo = $foobar - $bar;
print_r($foo);
?>
Expected result:
----------------
Array
(
[a] => 1
[b] => 2
[c] => 3
[d] => 4
)
Array
(
[a] => 1
[b] => 2
)
Actual result:
--------------
Array
(
[a] => 1
[b] => 2
[c] => 3
[d] => 4
)
Fatal error: Unsupported operand types in array.php on line 9
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=53170&edit=1