[FX.php List] PHP question

Jonathan Schwartz jschwartz at exit445.com
Thu Jan 14 07:53:34 MST 2010


How about this...

A strpos($haystack,$needle) would also work. The function is designed 
to return the position of the "needle" in the "haystack", but also 
returns "FALSE" if the needle does not exist.

I understand that it is faster than PREG.

if(strpos($_POST['Department_Name'],"Hall") !== FALSE)
  {
Do this
}

To avoid problems resulting from upper/lower case, use stripos().

Hope there is no "Monte Hall Hall" ;-)

HTH

Jonathan

>A preg_match will work.
>
>if (isset($_POST['Department_Name']) && preg_match('/hall$/i', 
>$_POST['Department_Name']) {
>--
>GARETH EVANS
>


-- 
Jonathan Schwartz
Exit 445 Group
jonathan at exit445.com
http://www.exit445.com
415-370-5011


More information about the FX.php_List mailing list