Created
April 21, 2011 08:39
-
-
Save robotamer/933986 to your computer and use it in GitHub Desktop.
php rstrstr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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, $start=0) | |
{ | |
return substr($haystack, $start,strpos($haystack, $needle)); | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment