note 88136 deleted from function.strpos by danbrown
| From: | danbrown@php.net | Date: | Mon, 12 Jan 2009 16:42:28 +0000 |
| Subject: | note 88136 deleted from function.strpos by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-149103@lists.php.net to get a copy of this message | ||
Note Submitter: Bill Smith
----
To make it easier to test positively whether a string contains something, I use a custom function
named "contains":
function contains($mystring, $findme) {
if (strpos($mystring, 'a') !== false) {
return true;
} else {
return false;
}
}
I use it like:
if ( contains($mystring, 'a') ) {
echo 'String contains "a".';
}