note 47805 deleted from function.stristr by nlopess
| From: | nlopess@php.net | Date: | Sat, 12 Mar 2005 22:58:03 +0000 |
| Subject: | note 47805 deleted from function.stristr by nlopess | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-86338@lists.php.net to get a copy of this message | ||
Note Submitter: corychristison[AT]NSPAMlavaube[dot]com
----
Here is the most simple way to check if an occurance of a string has occured, but case insensitive.
<?php
function in_istr ($hay, $needle) {
if( strpos(strtolower($hay), strtolower($needle)) ){
return true;
}
}
?>
or this if you don't mind it returning the position:
<?php
function in_istr ($hay, $needle) {
return strpos( strtolower($hay), strtolower($needle) );
}
?>