note 68364 added to function.strpos

From: Date: Mon, 24 Jul 2006 18:24:49 +0000
Subject: note 68364 added to function.strpos
Groups: php.notes 
Request: Send a blank email to php-notes+get-115101@lists.php.net to get a copy of this message
I finally figured out how to use this function correctly (and efficiently) if you want to test for a needle that may start at the beginning of haystack, simply use if (strpos($haystack, $needle) === 0)) { do stuff here.. } someone else mentioned that you needed to assign a variable first and test to make sure that it was === true first.. That is not needed ---- Server IP: 64.71.164.2 Probable Submitter: 204.88.250.240 ---- 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/68364 Del: integrated -- http://master.php.net/note/delete/68364/integrated Del: useless -- http://master.php.net/note/delete/68364/useless Del: bad code -- http://master.php.net/note/delete/68364/bad+code Del: spam -- http://master.php.net/note/delete/68364/spam Del: non-english -- http://master.php.net/note/delete/68364/non-english Del: in docs -- http://master.php.net/note/delete/68364/in+docs Del: other reasons-- http://master.php.net/note/delete/68364 Reject -- http://master.php.net/note/reject/68364 Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#115101) next »