function search_the_array($array) {
              global $search_tmp;
              $result = array_search($search_tmp, $array, TRUE);
               while (!($result === FALSE) && (list($k, $v) = each($array)))
               // Or maybe you wanted ereg($search_tmp, $v) here...
               $result = ereg($v, $search_tmp) ? $k : FALSE;
return ' '.$result; // extra space needed before the "key"

This code immediately returns a result, no matter what I type in there and
what the array consists of. I even tried searching "Singapore" for "I will
get a result no matter what I search for" and BANG... PHP fires back a
result. I didn't write the code myself so I have no idea what's going on
there... but I'd be glad if someone could help me. This code is supposed to
search an array until it finds "$search_tmp" inside it...



PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to