note 88187 added to function.strpos
| From: | BillSmith at osu1 dot php dot net | Date: | Wed, 14 Jan 2009 18:25:55 +0000 |
| Subject: | note 88187 added to function.strpos | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-149189@lists.php.net to get a copy of this message | ||
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;
}
----
Server IP: 209.41.74.194
Probable Submitter: 67.159.44.155
----
Manual Page -- http://www.php.net/manual/en/function.strpos.php
Edit -- https://master.php.net/note/edit/88187
Del: integrated -- https://master.php.net/note/delete/88187/integrated
Del: useless -- https://master.php.net/note/delete/88187/useless
Del: bad code -- https://master.php.net/note/delete/88187/bad+code
Del: spam -- https://master.php.net/note/delete/88187/spam
Del: non-english -- https://master.php.net/note/delete/88187/non-english
Del: in docs -- https://master.php.net/note/delete/88187/in+docs
Del: other reasons-- https://master.php.net/note/delete/88187
Reject -- https://master.php.net/note/reject/88187
Search -- https://master.php.net/manage/user-notes.php