Re: asterix for arrray_search?

From: Date: Sat, 18 Jun 2005 17:35:32 +0000
Subject: Re: asterix for arrray_search?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-217177@lists.php.net to get a copy of this message
As for now I have: if (array_search('5a', $emsg) OR array_search('5b', $emsg)){ ... that statement will get very long till z :-) Any ideas how to make something like this: array_search('5*', $emsg) How about something like:
search($emsg) { for($i = 0; $i < count($emsg); $i++)
    if(preg_match('/5[a-z]/', $emsg[$i]))
      return $i;
return -1; } Regards, Yasir

« previous php.general (#217177) next »