note 22825 added to function.in-array
| From: | php-general at lists dot php dot net | Date: | Mon, 01 Jul 2002 16:22:21 +0000 |
| Subject: | note 22825 added to function.in-array | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-32466@lists.php.net to get a copy of this message | ||
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.
--
http://www.php.net/manual/en/function.in-array.php
http://master.php.net/manage/user-notes.php?action=edit+22825
http://master.php.net/manage/user-notes.php?action=delete+22825
http://master.php.net/manage/user-notes.php?action=reject+22825