note 88187 deleted from function.strpos by danbrown
| From: | danbrown@php.net | Date: | Wed, 14 Jan 2009 18:47:15 +0000 |
| Subject: | note 88187 deleted from function.strpos by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-149190@lists.php.net to get a copy of this message | ||
Note Submitter: Bill Smith
----
Here\'s an easy way to use a \"positive\" test if a string contains something:
$mystring = \'abcdef\';
if ( contains($mystring, \'a\') ) {
echo \'String contains \"a\"\';
} else {
echo \'Does not contain \"a\"\';
}
// FUNCTION
function contains($mystring, $findme) {
return (strpos($mystring, $findme) !== false) ? TRUE : FALSE;
}