Re: array_diff not working with last element different
| From: | Andrey Hristov | Date: | Tue, 27 Aug 2002 14:04:41 +0000 |
| Subject: | Re: array_diff not working with last element different | ||
| References: | 1 2 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-87528@lists.php.net to get a copy of this message | ||
so, is there need of array_adiff()?
Best regards
Andrey Hristov
----- Original Message -----
From: "Stig Venaas" <venaas@php.net>
To: "Brad LaFountain" <rodif_bl@yahoo.com>
Cc: <php-dev@lists.php.net>
Sent: Tuesday, August 27, 2002 5:02 PM
Subject: Re: [PHP-DEV] array_diff not working with last element different
> 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
>
> --
> PHP Development Mailing List <http://www.php.net/>
> To unsubscribe, visit: http://www.php.net/unsub.php
>