note 22825 deleted from function.in-array by felipe
| From: | felipe@php.net | Date: | Sun, 30 Dec 2007 18:47:47 +0000 |
| Subject: | note 22825 deleted from function.in-array by felipe | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-134463@lists.php.net to get a copy of this message | ||
Note Submitter:
----
Looking at in_array, and array_search, I made up this small little example that does exactly what
_I_ want.
<?php
$online = array ("1337", "killer", "bob");
$find = array ("Damien", "bob", "fred", "1337");
while (list ($key, $val) = each ($find)) {
if (in_array ($val, $online)) {
echo $val . "<br>";
}
}
?>
Look for all instances of $find in $online. and print the element that was found.