note 35976 added to function.strrpos

From: Date: Sun, 21 Sep 2003 16:14:55 +0000
Subject: note 35976 added to function.strrpos
Groups: php.notes 
Request: Send a blank email to php-notes+get-56855@lists.php.net to get a copy of this message
If the string starts at the beginning, the return is zero. If it's not there, it returns "" (nothing, i.e. empty). Simple way to figure between all three: $result=strrpos($string, $needle); if(strlen($result)){ //even is string is 0, length is still 1 //it's there, zero really means zero (or first pos'tn in this case) }else{ //it's not there (returned empty); } ---- Manual Page -- http://www.php.net/manual/en/function.strrpos.php Edit Note -- http://master.php.net/manage/user-notes.php?action=edit+35976 Delete Note -- http://master.php.net/manage/user-notes.php?action=delete+35976&report=yes Reject Note -- http://master.php.net/manage/user-notes.php?action=reject+35976&report=yes

« previous php.notes (#56855) next »