How to be safe when PHP6 is released and ereg regex turns into extension instead of core
For those of you who don't know what's going to happen in PHP6, here's a nice read: http://jero.net/articles/php6
Now, if you have functions that depend on ereg and have no control over the php.ini file on the server that hosts your scripts, how do you deal with this?
For example, this function is here:
function currentDateTime() {
list($micro, $Unixtime) = explode(" ",microtime());
$sec= $micro + date("s", $Unixtime);
$sec = mb_ereg_replace(sprintf('%d', $sec), "", ($micro + date("s", $Unixtime)));
return date("Y-m-d H:i:s", $Unixtime).$sec;
}
It seems to depend on ereg, so how do you replace that?
+1
a source to share
2 answers