Re: asterix for arrray_search?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux