note 91214 modified in function.strstr by danbrown
| From: | danbrown@php.net | Date: | Mon, 01 Jun 2009 13:08:29 +0000 |
| Subject: | note 91214 modified in function.strstr by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-156255@lists.php.net to get a copy of this message | ||
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;
}
?>
--was--
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=strrev($result);
return $result;
}
?>
http://php.net/manual/en/function.strstr.php