note 55547 added to function.strrpos

From: Date: Sat, 06 Aug 2005 19:03:26 +0000
Subject: note 55547 added to function.strrpos
Groups: php.notes 
Request: Send a blank email to php-notes+get-93175@lists.php.net to get a copy of this message
If you are a VBScript programmer ("ex-" of course), you will find that 'strrpos' doesn't work like the VBScript 'instrRev' function. Here is the equivalent function: VBScript: k=instrrev(s,">",j); PHP Equivalent of the above VBScript: $k=strrpos(substr($s,0,$j),'>'); Comments: You might think (I did!) that the following PHP function call would be the equivant of the above VBScript call: $kk=strrpos($s,'>',$j); NOPE! In the above PHP call, $j defines the position in the string that should be considered the BEGINNING of the string, whereas in the VBScript call, j is to be considered the END of the string, as far as this search is concerned. Anyway, the above 'strrpos' with the 'substr' will work. (Probably faster to write a for loop!) ---- Manual Page -- http://www.php.net/manual/en/function.strrpos.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+55547 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+55547&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+55547&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+55547&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+55547&report=yes&reason=useless Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+55547&report=yes&reason=non-english Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+55547&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+55547&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#93175) next »