Re: extracting value from array
| From: | elias | Date: | Tue, 31 Jul 2001 11:51:14 +0000 |
| Subject: | Re: extracting value from array | ||
| References: | 1 2 | Groups: | php.windows |
| Request: | Send a blank email to php-windows+get-8590@lists.php.net to get a copy of this message | ||
nice one!
"Hugh Bothwell" <hugh_bothwell@hotmail.com> wrote in message
news:20010731021655.48897.qmail@pb1.pair.com...
> > <afan@sprout.net> wrote in message
> > news:011401c11958$26d38f60$2b43fea9@nyc.rr.com...
>
> > let's say there is an array with 10 elements.
> > One of elements has value 'xyz123' - I do not know which one.
> > How can I extract this element from the array and
> > have a new array with all other element, except extracted one.
>
> // original array
> $arr = array("a", "b", "c", "d", "xyz123",
> "f", "g");
> // list of values to remove
> $remove = array("xyz123");
>
> // do it
> $result = array_diff($arr, $remove);
>
> // show results
> foreach($result as $val)
> echo "<br>$val";
>
>
>