note 48886 added to function.strrpos

From: Date: Tue, 11 Jan 2005 03:12:46 +0000
Subject: note 48886 added to function.strrpos
Groups: php.notes 
Request: Send a blank email to php-notes+get-83059@lists.php.net to get a copy of this message
I was immediatley pissed when i found the behaviour of strrpos ( shouldnt it be called charrpos ?) the way it is, so i made my own implement to search for strings. <? function proper_strrpos($haystack,$needle){ while($ret = strrpos($haystack,$needle)) { if(strncmp(substr($haystack,$ret,strlen($needle)), $needle,strlen($needle)) == 0 ) return $ret; $haystack = substr($haystack,0,$ret -1 ); } return $ret; } ?> ---- Manual Page -- http://www.php.net/manual/en/function.strrpos.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+48886 Delete -- http://master.php.net/manage/user-notes.php?action=delete+48886&report=yes Reason: bad code -- http://master.php.net/manage/user-notes.php?action=delete+48886&report=yes&reason=bad+code Reason: spam -- http://master.php.net/manage/user-notes.php?action=delete+48886&report=yes&reason=spam Reason: useless example -- http://master.php.net/manage/user-notes.php?action=delete+48886&report=yes&reason=useless+example Reason: contains commercial links -- http://master.php.net/manage/user-notes.php?action=delete+48886&report=yes&reason=contains+commercial+links Reason: useless note -- http://master.php.net/manage/user-notes.php?action=delete+48886&report=yes&reason=useless+note Reject -- http://master.php.net/manage/user-notes.php?action=reject+48886&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#83059) next »