new files
This commit is contained in:
parent
3af7344581
commit
86c034bb8b
1364 changed files with 21352 additions and 0 deletions
9
Task/Search-a-list/PHP/search-a-list.php
Normal file
9
Task/Search-a-list/PHP/search-a-list.php
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
$haystack = array("Zig","Zag","Wally","Ronald","Bush","Krusty","Charlie","Bush","Bozo");
|
||||
|
||||
foreach (array("Washington","Bush") as $needle) {
|
||||
$i = array_search($needle, $haystack);
|
||||
if ($i === FALSE) // note: 0 is also considered false in PHP, so you need to specifically check for FALSE
|
||||
echo "$needle is not in haystack\n";
|
||||
else
|
||||
echo "$i $needle\n";
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue