Revision 29c3c942
Added by Colin Smith over 20 years ago
etc/inc/pfsense-utils.inc | ||
---|---|---|
660 | 660 |
* reverse_strrchr($haystack, $needle): Return everything in $haystack up to the *last* instance of $needle. |
661 | 661 |
* Useful for finding paths and stripping file extensions. |
662 | 662 |
*/ |
663 |
function reverse_strrchr($haystack, $needle) { |
|
664 |
$pos = strrpos($haystack, $needle); |
|
665 |
if($post === false) { |
|
666 |
return $haystack; |
|
667 |
} |
|
668 |
return substr($haystack, 0, $post + 1); |
|
663 |
function reverse_strrchr($haystack, $needle) |
|
664 |
{ |
|
665 |
return strrpos($haystack, $needle) ? substr($haystack, 0, strrpos($haystack, $needle) +1 ) : false; |
|
669 | 666 |
} |
670 | 667 |
|
671 | 668 |
/* |
Also available in: Unified diff
Update reverse_strrchr().