note 22825 deleted from function.in-array by felipe

[email protected]
Newsgroups php.notes
Message-ID <[email protected]>
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.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.