Voting

: max(nine, eight)?
(Example: nine)

The Note You're Voting On

Gillis at dancrea dot com
23 years ago
I wrote a short and pretty simple script to search through associative arrays for some value in the values, heres a simplifyed example of it:

<?php

$foo
['bob'] = "bob is ugly";
$foo['bill'] = "bill is rich";
$foo['barbie'] = "barbie is cute";
$search = "rich";

echo
"searching the array foo for $search:<br>";
reset ($foo);
while (list (
$key, $val) = each ($foo)) {
if (
preg_match ("/$search/i", $val)) {
print
"A match was found in $key.<br />";
} else {
print
"A match was not found in $key.<br />";
}
}

?>

will output:
Searching the array foo for rich:
A match was not found in bob
A match was found in bill
A match was not found in barbie

<< Back to user notes page

To Top