note 91214 deleted from function.strstr by danbrown
| From: | danbrown@php.net | Date: | Thu, 27 Oct 2011 18:46:25 +0000 |
| Subject: | note 91214 deleted from function.strstr by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-184182@lists.php.net to get a copy of this message | ||
Note Submitter: dpac dot mittal at gmail dot com
----
You can emulate the $before_needle before v5.3 in a very very simple way. Just applied a bit of
common sense.
Here's the code:
<?php
function strstrbef($haystack, $needle)
{
$needle=strrev($needle);
$haystack=strrev($haystack);
$result=strstr($haystack,$needle);
$result=substr($haystack,strlen($needle));
$result=strrev($result);
return $result;
}
?>