RE: [PHP] removing an element from an array
| From: | Daniel Perez Clavero | Date: | Wed, 01 Oct 2003 11:45:32 +0000 |
| Subject: | RE: [PHP] removing an element from an array | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-164538@lists.php.net to get a copy of this message | ||
I know but was just a sample, try to use $array1 instead of $array_result.
Note: keys remain the same.
$array2[0]="Value to extract";
$array1 = array_diff ($array1, $array2);
-----Original Message-----
From: Dennis Sterzenbach [mailto:lists@darknoise.de]
Sent: miércoles, 01 de octubre de 2003 13:24
To: php-general@lists.php.net
Subject: Re: [PHP] removing an element from an array
"Daniel Perez Clavero" <daniel.perez@madrid.sema.slb.com> wrote in
message
news:NDEKIMJLKBNGEIOBDFOJCEGBCEAA.daniel.perez@madrid.sema.slb.com...
> Angelo,
> Given array1 extract array2 from there, and put it into $array_result.
>
> $array2[0]="Value to extract";
> $array_result = array_diff ($array1, $array2);
>
> Should work.
> Rgrds.
Well this only returns the differences between $array1 and $array2.
But it doesn't touch/change the arrays themselves.
--
Dennis Sterzenbach
www.darknoise.de
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php