note 93565 deleted from function.strpos by danbrown
| From: | danbrown@php.net | Date: | Wed, 16 Sep 2009 17:28:06 +0000 |
| Subject: | note 93565 deleted from function.strpos by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-160754@lists.php.net to get a copy of this message | ||
Note Submitter: juniordez at gmail dot com
----
Function to get the string position before the pos passed:
<?php
function strposReverse( $str, $search, $pos ){
$str = strrev($str);
$search = strrev($search);
$pos = (strlen($str) - 1) - $pos;
$posRev = strpos( $str, $search, $pos );
return (strlen($str) - 1) - $posRev - (strlen($search) - 1);
}
?>