note 25371 deleted from function.strpos by nlopess

From: Date: Tue, 25 Jul 2006 11:21:37 +0000
Subject: note 25371 deleted from function.strpos by nlopess
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-115148@lists.php.net to get a copy of this message
Note Submitter: anonymous dot coward at slashdot dot org ---- 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).

« previous php.notes (#115148) next »