Re: array_diff not working with last element different
| From: | Stig Venaas | Date: | Tue, 27 Aug 2002 14:02:40 +0000 |
| Subject: | Re: array_diff not working with last element different | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-87527@lists.php.net to get a copy of this message | ||
On Tue, Aug 27, 2002 at 06:39:57AM -0700, Brad LaFountain wrote:
> <?
> $ar = array("b" => 1, "blah" => 1);
> $a1 = array("b" => 1, "blah" => 2);
> var_dump(array_diff($ar, $a1));
> ?>
> array(0) {
> }
I guess this may not be clear from documentation. array_diff() works
with values. So it will return all values from first array that are
not in the others. Since the value 1 is present in $a1, all elements
of value 1 are removed from $ar in the returned array.
Stig