note 55547 deleted from function.strrpos by googleguy
| From: | googleguy@php.net | Date: | Tue, 22 Oct 2013 14:53:36 +0000 |
| Subject: | note 55547 deleted from function.strrpos by googleguy | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-197203@lists.php.net to get a copy of this message | ||
Note Submitter: lwoods
----
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!)