3v4l.org

run code in 300+ PHP versions simultaneously
<?php function timeSince($time, $from = null) { if ($from == null) { $from = time(); } $time = $from - $time; $chunks = array( array(60 * 60 * 24 * 365 , 'year'), array(60 * 60 * 24 * 30 , 'month'), array(60 * 60 * 24 , 'day'), array(60 * 60 , 'hour'), array(60 , 'minute'), array(1 , 'second') ); for ($i = 0, $j = count($chunks); $i < $j; $i++) { $seconds = $chunks[$i][0]; $name = $chunks[$i][1]; if (($count = floor($time / $seconds)) != 0) { break; } } $print = ($count == 1) ? '1 '.$name : "$count {$name}s"; return $print; } $dt = new DateTime('2012-10-11'); echo timeSince($dt);

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.4.00.0060.01215.45
7.3.120.0070.01115.09
7.3.110.0040.01115.23
7.3.100.0030.01215.23
7.3.90.0040.01115.00
7.3.80.0100.00614.85
7.3.70.0000.01615.10
7.3.60.0030.00714.71
7.3.50.0000.00915.04
7.3.40.0030.01315.05
7.3.30.0130.00714.82
7.3.20.0100.00316.91
7.3.10.0100.00816.72
7.3.00.0070.00916.87
7.2.250.0120.00614.86
7.2.240.0030.01315.25
7.2.230.0130.00315.24
7.2.220.0060.00915.25
7.2.210.0060.00614.90
7.2.200.0070.01115.24
7.2.190.0100.00315.11
7.2.180.0070.00315.05
7.2.170.0030.01415.36
7.2.130.0130.00617.21
7.2.120.0070.01117.15
7.2.110.0030.01417.24
7.2.100.0000.01516.74
7.2.90.0000.01516.93
7.2.80.0090.00617.30
7.2.70.0070.00716.99
7.2.60.0080.00717.05
7.2.50.0080.00517.04
7.2.40.0030.00617.13
7.2.30.0090.00617.23
7.2.20.0000.01317.26
7.2.10.0070.00717.20
7.2.00.0060.00917.01
7.1.330.0080.00815.90
7.1.320.0070.00415.95
7.1.310.0040.00716.01
7.1.300.0070.00715.87
7.1.290.0040.01215.97
7.1.280.0140.00316.00
7.1.270.0000.01915.50
7.1.260.0060.00616.06
7.1.250.0140.01015.95
7.1.200.0140.00015.99
7.1.70.0090.00317.37
7.1.60.0070.01519.32
7.1.50.0030.00717.33
7.1.00.0000.07722.35
7.0.200.0030.00516.97
7.0.140.0070.07322.09
7.0.80.0470.07019.95
7.0.70.0530.09019.95
7.0.60.0670.07720.00
7.0.50.0500.07020.32
7.0.40.0030.08720.04
7.0.30.0030.08020.10
7.0.20.0100.07720.13
7.0.10.0070.07720.09
7.0.00.0070.06720.04
5.6.280.0030.09321.16
5.6.230.0070.08020.52
5.6.220.0070.08320.66
5.6.210.0070.04720.66
5.6.200.0030.09321.13
5.6.190.0070.04321.07
5.6.180.0070.05721.02
5.6.170.0070.06321.10
5.6.160.0100.07721.11
5.6.150.0100.08721.07
5.6.140.0100.08321.06
5.6.130.0200.07721.05
5.6.120.0230.06021.11
5.6.110.0100.07020.95
5.6.100.0070.08321.01
5.6.90.0170.08021.01
5.6.80.0130.05720.45
5.6.70.0030.08020.55
5.6.60.0130.07720.49
5.6.50.0030.07720.48
5.6.40.0100.06720.45
5.6.30.0130.04720.39
5.6.20.0030.05720.41
5.6.10.0130.04720.38
5.6.00.0070.07020.40
5.5.370.0030.08320.53
5.5.360.0130.04020.36
5.5.350.0130.07320.35
5.5.340.0070.08720.77
5.5.330.0070.06720.75
5.5.320.0070.08320.80
5.5.310.0070.08020.74
5.5.300.0100.08020.80
5.5.290.0070.06720.82
5.5.280.0030.08320.89
5.5.270.0100.08020.78
5.5.260.0100.08320.83
5.5.250.0030.06020.75
5.5.240.0030.07720.33
5.5.230.0130.07320.18
5.5.220.0100.07320.31
5.5.210.0070.07720.16
5.5.200.0070.08320.30
5.5.190.0030.08720.16
5.5.180.0030.07020.20
5.5.160.0070.05320.22
5.5.150.0030.07720.25
5.5.140.0070.05320.00
5.5.130.0030.04720.16
5.5.120.0030.08020.19
5.5.110.0100.07020.09
5.5.100.0130.05320.09
5.5.90.0130.07320.07
5.5.80.0000.05720.02
5.5.70.0070.07320.09
5.5.60.0100.04720.07
5.5.50.0070.04319.97
5.5.40.0170.06320.16
5.5.30.0030.04320.14
5.5.20.0070.08020.09
5.5.10.0100.07720.04
5.5.00.0000.04320.11
5.4.450.0100.08019.45
5.4.440.0070.08319.50
5.4.430.0100.07019.37
5.4.420.0170.07019.50
5.4.410.0130.07319.24
5.4.400.0100.07719.18
5.4.390.0470.04719.21
5.4.380.0070.07319.23
5.4.370.0000.07319.18
5.4.360.0070.07718.95
5.4.350.0100.07319.21
5.4.340.0070.07319.04
5.4.320.0070.05319.18
5.4.310.0130.07719.18
5.4.300.0100.07319.13
5.4.290.0100.07719.23
5.4.280.0100.07019.11
5.4.270.0100.06718.94
5.4.260.0000.05019.09
5.4.250.0030.08719.12
5.4.240.0000.08719.11
5.4.230.0100.06019.04
5.4.220.0030.05719.14
5.4.210.0100.07019.14
5.4.200.0070.04718.84
5.4.190.0100.04318.93
5.4.180.0100.05719.11
5.4.170.0130.06019.02
5.4.160.0070.07019.19
5.4.150.0130.07019.00
5.4.140.0130.07016.55
5.4.130.0130.06316.33
5.4.120.0030.07016.39
5.4.110.0030.07316.54
5.4.100.0070.06716.56
5.4.90.0030.03716.48
5.4.80.0130.06016.48
5.4.70.0030.05316.38
5.4.60.0000.03716.42
5.4.50.0000.07016.48
5.4.40.0030.06316.42
5.4.30.0130.06316.32
5.4.20.0100.03716.38
5.4.10.0070.07016.43
5.4.00.0070.07015.77
5.3.290.0100.06714.81
5.3.280.0130.06314.70
5.3.270.0130.06714.68
5.3.260.0070.07014.60
5.3.250.0170.02714.74
5.3.240.0030.08014.61
5.3.230.0070.03714.61
5.3.220.0030.03714.59
5.3.210.0070.06714.54
5.3.200.0170.02714.64
5.3.190.0130.07014.51
5.3.180.0030.07014.64
5.3.170.0000.06714.70
5.3.160.0100.07714.64
5.3.150.0170.06714.64
5.3.140.0030.08014.71
5.3.130.0130.07014.68
5.3.120.0130.07014.53
5.3.110.0200.05314.58
5.3.100.0130.06014.11
5.3.90.0100.06314.15
5.3.80.0000.05714.00
5.3.70.0030.07314.15
5.3.60.0000.04314.02
5.3.50.0070.07713.95
5.3.40.0000.07713.86
5.3.30.0070.07014.01
5.3.20.0030.07713.73
5.3.10.0200.06313.75
5.3.00.0130.07013.71
5.2.170.0000.06711.19
5.2.160.0030.06311.07
5.2.150.0070.04011.07
5.2.140.0070.06011.07
5.2.130.0070.06011.25
5.2.120.0030.06311.17
5.2.110.0100.05011.04
5.2.100.0030.06311.13
5.2.90.0070.06311.23
5.2.80.0070.03711.22
5.2.70.0070.05711.04
5.2.60.0030.06711.05
5.2.50.0070.05711.15
5.2.40.0070.05711.11
5.2.30.0000.04311.00
5.2.20.0100.05310.89
5.2.10.0030.06010.98
5.2.00.0030.06710.63
5.1.60.0030.03010.08
5.1.50.0000.04710.11
5.1.40.0070.02710.07
5.1.30.0070.05310.34
5.1.20.0100.03710.41
5.1.10.0070.05710.07
5.1.00.0000.04710.14
5.0.50.0030.0438.59
5.0.40.0000.0408.51
5.0.30.0070.0478.34
5.0.20.0000.0338.28
5.0.10.0000.0408.24
5.0.00.0030.0678.24
4.4.90.0000.0237.18
4.4.80.0000.0377.18
4.4.70.0000.0277.18
4.4.60.0030.0337.18
4.4.50.0030.0307.18
4.4.40.0030.0537.18
4.4.30.0070.0307.18
4.4.20.0030.0337.18
4.4.10.0070.0307.18
4.4.00.0000.0537.18
4.3.110.0030.0337.18
4.3.100.0000.0307.18
4.3.90.0030.0337.18
4.3.80.0000.0407.18
4.3.70.0070.0177.18
4.3.60.0030.0237.18
4.3.50.0030.0337.18
4.3.40.0030.0437.18
4.3.30.0000.0237.18
4.3.20.0030.0377.18
4.3.10.0030.0207.18
4.3.00.0000.0377.18

preferences:
53 ms | 401 KiB | 5 Q