note 63539 added to function.strpos
| From: | leibwaechter at web dot de | Date: | Thu, 23 Mar 2006 09:26:20 +0000 |
| Subject: | note 63539 added to function.strpos | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-106455@lists.php.net to get a copy of this message | ||
If you only want to look, if a string appears in another string - even at position 0 - , you can
also use substr_count():
<?php
$mystring = "Hello Chris";
if (substr_count($mystring, "Hello") == 0)
echo "no";
// same as:
if (strpos($mystring, "Hello") === false)
echo "no";
?>
----
Server IP: 66.163.161.117
Probable Submitter: 84.44.166.210
----
X-Spam-Status: No, hits=3.1 required=5.0 tests=DATE_MISSING,FROM_NO_LOWER
autolearn=no version=2.64
----
Manual Page -- http://www.php.net/manual/en/function.strpos.php
Edit -- http://master.php.net/note/edit/63539
Del: integrated -- http://master.php.net/note/delete/63539/integrated
Del: useless -- http://master.php.net/note/delete/63539/useless
Del: bad code -- http://master.php.net/note/delete/63539/bad+code
Del: spam -- http://master.php.net/note/delete/63539/spam
Del: non-english -- http://master.php.net/note/delete/63539/non-english
Del: in docs -- http://master.php.net/note/delete/63539/in+docs
Del: other reasons-- http://master.php.net/note/delete/63539
Reject -- http://master.php.net/note/reject/63539
Search -- http://master.php.net/manage/user-notes.php