3v4l.org

run code in 300+ PHP versions simultaneously
<?php function convertToTimestamp($dateStr) { $dateStr = trim($dateStr); echo function_exists("date_create") if (!function_exists('date_create')) { return strtotime($dateStr); } $oDate = date_create($dateStr); if ($oDate instanceof DateTime) { #$curErrors = $oDate->getLastErrors(); #print_r($curErrors); #$curErrors = array_filter($curErrors, 'is_numeric'); #$curErrors = (bool)array_sum($curErrors); #if (!$curErrors) { return (int)$oDate->format('U'); #} } return false; } echo convertToTimestamp("2012-01-01"); // 1325376000 echo "<br>"; var_dump( convertToTimestamp("foo") ); // sollte false

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.0140.04712.01
5.4.50.0140.04412.00
5.4.40.0140.04112.00
5.4.30.0150.04511.99
5.4.20.0140.04411.99
5.4.10.0150.04011.99
5.4.00.0150.04611.48
5.3.160.0160.04312.67
5.3.150.0150.04312.67
5.3.140.0240.07712.66
5.3.130.0160.04312.66
5.3.120.0130.04712.66
5.3.110.0130.04712.66
5.3.100.0140.04412.12
5.3.90.0110.04512.10
5.3.80.0160.04212.09
5.3.70.0240.05612.09
5.3.60.0180.05412.07
5.3.50.0150.04612.02
5.3.40.0170.04312.02
5.3.30.0140.04411.98
5.3.20.0160.04511.76
5.3.10.0160.04111.73
5.3.00.0140.04611.71

preferences:
138.06 ms | 1394 KiB | 7 Q