> is there also a way to search for, let's say '*china*' because in my array
> it would say "Republic of China" and when searching for "china" I get no
> result from the array...

You'd have to walk through the array and use strstr or ereg for that.

You could maybe use PHP's array_walk function, but that might be a bit
tricky for a beginner, unless you've programmed before...

function my_array_search($needle, $haystack){
    # Go ahead and use the built-in one, in case it's a perfect match:
    $result = array_search($needle, $haystack);
    while (!($result === FALSE) && (list($k, $v) = each($haystack)){
        # Or maybe you wanted ereg($needle, $v) here...
        $result = ereg($v, $needle) ? $k : FALSE;
    return $result;

WARNING [EMAIL PROTECTED] address is an endangered species -- Use
Wanna help me out?  Like Music?  Buy a CD: http://l-i-e.com/artists.htm
Volunteer a little time: http://chatmusic.com/volunteer.htm

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