Been using this for years:
<?php
/**
*
* @author : Dennis T Kaplan
*
* @version : 1.0
* Date : June 17, 2007
* Function : reverse strstr()
* Purpose : Returns part of haystack string from start to the first occurrence of needle
* $haystack = 'this/that/whatever';
* $result = rstrstr($haystack, '/')
* $result == this
*
* @access public
* @param string $haystack, string $needle
* @return string
**/
function rstrstr($haystack,$needle)
{
return substr($haystack, 0,strpos($haystack, $needle));
}
?>
You could change it to:
rstrstr ( string $haystack , mixed $needle [, int $start] )
<?php
function rstrstr($haystack,$needle, $start=0)
{
return substr($haystack, $start,strpos($haystack, $needle));
}
?>