3v4l.org

run code in 300+ PHP versions simultaneously
<?php function convertToTimestamp($str) { $str = trim($str); if (!function_exists('date_create')) { $ts = strtotime($str); // Doku: Vor PHP 5.1.0 gab die Funktion -1 im Fehlerfall zurück. if ($ts === -1) $ts = false; return $ts; } $oDate = date_create($str); #if (is_object($oDate)) { if ($oDate instanceof DateTime ( { return (int)$oDate->format('U'); } return false; } var_dump( convertToTimestamp("2012-01-01") ); // 1325376000 echo "\n"; var_dump( convertToTimestamp("foo") ); // sollte false oder -1

Here you find the average performance (time & memory) of each version. A grayed out version indicates it didn't complete successfully (based on exit-code).

VersionSystem time (s)User time (s)Memory (MiB)
5.4.60.0240.06712.00
5.4.50.0200.07012.00
5.4.40.0180.05411.98
5.4.30.0160.04811.98
5.4.20.0170.05411.98
5.4.10.0130.05211.98
5.4.00.0210.05711.47
5.3.160.0170.06212.67
5.3.150.0210.05912.67
5.3.140.0220.06912.66
5.3.130.0210.06512.66
5.3.120.0170.04112.66
5.3.110.0150.04612.66
5.3.100.0170.06312.12
5.3.90.0160.06112.09
5.3.80.0160.05812.08
5.3.70.0210.06612.07
5.3.60.0190.07012.06
5.3.50.0230.06612.00
5.3.40.0160.04912.00
5.3.30.0220.06111.96
5.3.20.0140.05311.75
5.3.10.0150.04711.70
5.3.00.0190.06611.70

preferences:
132.69 ms | 1398 KiB | 7 Q