note 25371 added to function.strpos

From: Date: Fri, 20 Sep 2002 19:19:38 +0000
Subject: note 25371 added to function.strpos
Groups: php.notes 
Request: Send a blank email to php-notes+get-37066@lists.php.net to get a copy of this message
Even simpler method to get around that zero/false headache: if (strpos(' '.$string,$substring) > 1) { echo('substring present!'); } Simly add a space to your string being tested. Your first real string position then becomes 1, and zero really means "string not found". Please adjust your position formulas accordingly (substract 1). -- http://www.php.net/manual/en/function.strpos.php http://master.php.net/manage/user-notes.php?action=edit+25371 http://master.php.net/manage/user-notes.php?action=delete+25371 http://master.php.net/manage/user-notes.php?action=reject+25371

« previous php.notes (#37066) next »