Bug #10429: Improving substr()
| From: | sbergmann@php.net | Date: | Sat, 21 Apr 2001 09:09:31 +0000 |
| Subject: | Bug #10429: Improving substr() | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-52098@lists.php.net to get a copy of this message | ||
From: sbergmann@php.net
Operating system:
PHP version: 4.0.4pl1
PHP Bug Type: Feature/Change Request
Bug description: Improving substr()
I am currently using the following PHP Code to get a substring from a string, that is delimited by
two given strings, $start and $end:
function my_substr($start, $end, &$string) {
$start = preg_quote($start);
$end = preg_quote($end);
preg_match("#$start(.*?)$end#", $string, $result);
return $result[1];
}
It would be great if PHP's substr() function could handle operations like this, by changing its
signature accordingly, maybe to
string substr (string string, mixed start [, mixed end])
--
Edit Bug report at: http://bugs.php.net/?id=10429&edit=1