On 12.10.2009, at 21:48, Joey Smith wrote:
Write yourself a bit of code that replaces ereg which could be
installed in an
auto_prepend location server-wide. Here's an example you could start
with,
although I should point out that I spent all of about 30 seconds
thinking about
it, so you might want to give it more thought than that - I'm sure
there are some
funny edge cases in the way people have relied on ereg behaviour,
but you'd be
more likely to know that than I since I haven't used ereg() since
the day PCRE
support was added to PHP.
if (! function_exists('ereg')) {
function ereg($pattern, $string, &$regs = array()) {
$matches = array();
$delimiters = array(chr(1),chr(1),chr(1),chr(1),chr(1),chr(1),'/',
'@', '#', '%', '_');
foreach($delimiters as $c) { if (strpos($string, $c) !== FALSE)
continue; $d = $c; }
if (preg_match_all($d.$pattern.$d, $string, $matches)) return
strlen($string);
return false;
}
}
Much the same could be done for split(), ereg_replace(), and so on.
Feel free to collaborate with the authors of PHP_Compat [1].
regards,
Lukas Kahwe Smith
m...@pooteeweet.org
[1] http://pear.php.net/package/PHP_Compat
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php