note 9534 deleted from function.strpos by jimw

From: Date: Thu, 18 Oct 2001 21:25:52 +0000
Subject: note 9534 deleted from function.strpos by jimw
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-19128@lists.php.net to get a copy of this message
refering to note of juliano@brasileiros.com.br 10-Sep-2000 11:39 this checks for $pos beeing not a string (it is a number than) and $pos beeing false (meaning 0 or empty). though this would check if $needle was found at the first position of $haystack. this worked fine for me: $pos = strpos($haystack, $needle); if ((string)$pos != "") { //found } $pos = strpos($haystack, $needle); if ((string)$pos == "") { //not found } some of the above mentioned variants didn't work for me. i don't think that -1 is a good way to alter the function because all the old applications wouldn't work anymore. up to me the === is sufficient :-)

« previous php.notes (#19128) next »