note 451 modified in strpos by ronabop

From: Date: Wed, 13 Dec 2000 06:21:44 +0000
Subject: note 451 modified in strpos by ronabop
Groups: php.notes 
Request: Send a blank email to php-notes+get-8684@lists.php.net to get a copy of this message
Note that strpos' character index is zero-based; a character match on the first character returns zero (strpos('ab', 'a') = 0). Thus, a test such as if (strpos($hay, $needle)) { ... } can give a false negative. You can use the empty() function or an explicit test (strpos(...) >= 0) to avoid this. http://www.php.net/manual/function.strpos.php

« previous php.notes (#8684) next »