3v4l.org

run code in 300+ PHP versions simultaneously
<?php function measture_duration(callable $callback) { $start = microtime(true); call_user_func($callback); $duration = microtime(true) - $start; printf("Duration: %s\n\n", number_format($duration, 6)); } function timestamp_lowest(array $array) { return min(array_column($array, 'ts')); } function timestamp_lowest2(array $array) { $values = array_column($array, 'ts'); $values = array_slice($values, 1); return min($values); } $timezone = new DateTimeZone('Europe/Berlin'); $duration = measture_duration(function() use($timezone) { printf("Default Value\n"); $result = $timezone->getTransitions(); $lowest = timestamp_lowest($result); printf("Lowest timestamp: %s (%s)\n", $lowest, date('Y-m-d', $lowest)); $lowest2 = timestamp_lowest2($result); printf("Lowest timestamp2: %s (%s)\n", $lowest2, date('Y-m-d', $lowest2)); }); $duration = measture_duration(function() use($timezone) { $timestamp = 0; printf("Timestamp for %s\n", date('Y-m-d H:i:s', $timestamp)); $result = $timezone->getTransitions($timestamp); $lowest = timestamp_lowest($result); printf("Lowest timestamp: %s (%s)\n", $lowest, date('Y-m-d', $lowest)); }); $duration = measture_duration(function() use($timezone) { $timestamp = -62135596800; printf("Timestamp for %s\n", date('Y-m-d H:i:s', $timestamp)); $result = $timezone->getTransitions($timestamp); $lowest = timestamp_lowest($result); printf("Lowest timestamp: %s (%s)\n", $lowest, date('Y-m-d', $lowest)); });

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)
7.3.10.0070.01016.59
7.3.00.0060.00916.94
7.2.130.0060.00916.97
7.2.120.0060.00917.35
7.2.110.0040.01216.94
7.2.100.0060.00917.25
7.2.90.0060.00916.95
7.2.80.0000.01116.82
7.2.70.0060.00917.05
7.2.60.0060.00917.19
7.2.50.0030.00917.11
7.2.40.0060.01017.28
7.2.30.0060.00616.81
7.2.20.0060.01216.96
7.2.10.0100.00717.23
7.2.00.0070.01016.80
7.1.250.0000.06616.16
7.1.80.0150.07418.39
7.1.70.0030.14217.03
7.1.60.0240.07135.16
7.1.50.0160.12135.12
7.1.40.0260.11534.57
7.1.30.0250.07434.77
7.1.20.0220.13634.84
7.1.10.0030.14616.82
7.1.00.0080.13716.86
7.0.200.0060.07516.63
7.0.190.0060.09216.61
7.0.180.0090.09816.19
7.0.170.0030.07216.41
7.0.160.0110.13716.09
7.0.150.0120.13716.43
7.0.140.0030.12616.35
7.0.130.0090.08016.57
7.0.120.0040.07216.44
7.0.110.0090.11216.51
7.0.100.0100.10216.55
7.0.90.0000.07416.23
7.0.80.0160.10016.32
7.0.70.0100.12716.49
7.0.60.0070.13416.15
7.0.50.0030.13416.52
7.0.40.0030.13616.70
7.0.30.0130.07916.41
7.0.20.0140.06916.37
7.0.10.0030.08816.46
7.0.00.0120.09416.37

preferences:
40.94 ms | 403 KiB | 5 Q