try preg_grep() http://www.php.net/manual/en/function.preg-grep.php
example: <? $word = array('alpha', 'beta', 'php'); // match anything beginning with upper or lower case p $matches_array = preg_grep('/^(p|P).*/', $word); print_r($matches_array); ?> Jim Grill Support Web-1 Hosting http://www.web-1hosting.net ----- Original Message ----- From: "andy" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Tuesday, July 30, 2002 10:36 AM Subject: [PHP] searching an array for words starting with 'p' > Hi there, > > I am wondering how to search an array for words starting with a certain > character. > > E.G: > > $word = array('alpha', 'beta', 'php'); > > I would like to check if there is a word in the array starting with p > > Is there alrready a function for this? > > Thanx, Andy > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php