php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #53170 Cannot substract Arrays
Submitted: 2010-10-26 17:37 UTC Modified: 2010-10-26 20:16 UTC
Votes:1
Avg. Score:3.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: gmblar+php at gmail dot com Assigned:
Status: Open Package: Arrays related
PHP Version: 5.3.3 OS: Linux
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: gmblar+php at gmail dot com
New email:
PHP Version: OS:

 

 [2010-10-26 17:37 UTC] 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

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-10-26 20:16 UTC] gmblar+php at gmail dot com
Expect same behavior as array_diff() http://de.php.net/manual/en/function.array-
diff.php
 
PHP Copyright © 2001-2017 The PHP Group
All rights reserved.
Last updated: Sun Nov 19 01:31:42 2017 UTC