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->date);

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.0160.00014.88
7.3.120.0070.01015.07
7.3.110.0080.00814.93
7.3.100.0110.00015.17
7.3.90.0060.00915.04
7.3.80.0080.00814.95
7.3.70.0000.01015.11
7.3.60.0060.00914.91
7.3.50.0000.01615.26
7.3.40.0040.01215.11
7.3.30.0070.00715.01
7.3.20.0100.00716.65
7.3.10.0070.01016.71
7.3.00.0090.00617.04
7.2.250.0100.01015.48
7.2.240.0100.01015.55
7.2.230.0040.00715.22
7.2.220.0060.00915.21
7.2.210.0030.00915.59
7.2.200.0030.00715.42
7.2.190.0110.00315.15
7.2.180.0040.01115.25
7.2.170.0080.00815.34
7.2.60.0040.01116.73
7.2.50.0060.00917.24
7.1.330.0090.00615.91
7.1.320.0060.00316.07
7.1.310.0110.00316.17
7.1.300.0080.00515.81
7.1.290.0040.01115.82
7.1.280.0080.00415.81
7.1.270.0040.01115.89
7.1.260.0030.00616.10
7.1.200.0000.01016.14
7.1.70.0130.00317.12
7.1.60.0000.02519.32
7.1.50.0040.00817.19
7.1.00.0070.07322.28
7.0.200.0070.00317.00
7.0.140.0000.07722.01
7.0.100.0130.07320.03
7.0.90.0100.08019.93
7.0.80.0070.04719.92
7.0.70.0100.08319.99
7.0.60.0070.08319.94
7.0.50.0130.08020.41
7.0.40.0170.08020.07
7.0.30.0070.07320.01
7.0.20.0170.07720.07
7.0.10.0070.08320.14
7.0.00.0070.05020.12
5.6.280.0100.06721.00
5.6.250.0100.04720.63
5.6.240.0130.07720.52
5.6.230.0130.03320.60
5.6.220.0070.05720.60
5.6.210.0100.07720.59
5.6.200.0070.08021.18
5.6.190.0100.08321.08
5.6.180.0100.07321.05
5.6.170.0100.05021.02
5.6.160.0170.07321.09
5.6.150.0070.07320.94
5.6.140.0070.07720.97
5.6.130.0130.07020.98
5.6.120.0070.07721.09
5.6.110.0100.04021.05
5.6.100.0130.08321.03
5.6.90.0100.05321.04
5.6.80.0070.07320.50
5.6.70.0100.08020.50
5.6.60.0070.08320.42
5.6.50.0000.05320.44
5.6.40.0070.07720.41
5.6.30.0070.04720.42
5.6.20.0130.05720.40
5.6.10.0170.04020.41
5.6.00.0100.08020.43
5.5.380.0030.08720.52
5.5.370.0100.08020.46
5.5.360.0130.04320.38
5.5.350.0070.08020.49
5.5.340.0100.06020.85
5.5.330.0070.08320.66
5.5.320.0070.08720.66
5.5.310.0070.08720.90
5.5.300.0100.07720.83
5.5.290.0070.08720.93
5.5.280.0130.08020.94
5.5.270.0070.08720.92
5.5.260.0070.08020.92
5.5.250.0200.03720.63
5.5.240.0070.08020.29
5.5.230.0100.06320.30
5.5.220.0000.08020.03
5.5.210.0130.04020.14
5.5.200.0030.04720.16
5.5.190.0030.08320.01
5.5.180.0170.07320.19
5.5.160.0170.07720.09
5.5.150.0170.07020.28
5.5.140.0170.06720.29
5.5.130.0030.10020.29
5.5.120.0030.06320.14
5.5.110.0100.08020.16
5.5.100.0070.07720.09
5.5.90.0100.03720.07
5.5.80.0030.07320.08
5.5.70.0000.06020.17
5.5.60.0000.08020.06
5.5.50.0070.04720.05
5.5.40.0100.07720.06
5.5.30.0070.05020.15
5.5.20.0070.05720.04
5.5.10.0030.05019.98
5.5.00.0000.06020.04
5.4.450.0130.07719.38
5.4.440.0070.07719.48
5.4.430.0070.08319.22
5.4.420.0170.07319.55
5.4.410.0130.07319.25
5.4.400.0070.07718.88
5.4.390.0070.04719.07
5.4.380.0030.04019.03
5.4.370.0030.07718.90
5.4.360.0070.07719.05
5.4.350.0070.04719.03
5.4.340.0030.05019.12
5.4.320.0070.08019.05
5.4.310.0000.07719.18
5.4.300.0070.04319.11
5.4.290.0200.06019.04
5.4.280.0130.04019.18
5.4.270.0070.03719.04
5.4.260.0070.07719.13
5.4.250.0030.06719.17
5.4.240.0130.07019.03
5.4.230.0030.07319.20
5.4.220.0070.07019.22
5.4.210.0030.07718.84
5.4.200.0100.07319.20
5.4.190.0070.07319.04
5.4.180.0130.07319.11
5.4.170.0030.05319.11
5.4.160.0100.07319.10
5.4.150.0030.05019.19
5.4.140.0130.06316.51
5.4.130.0130.07016.46
5.4.120.0100.05716.54
5.4.110.0030.07716.38
5.4.100.0000.07016.45
5.4.90.0200.05716.55
5.4.80.0100.03716.53
5.4.70.0000.04316.52
5.4.60.0070.06716.53
5.4.50.0030.07316.25
5.4.40.0030.06016.52
5.4.30.0070.06716.36
5.4.20.0030.07016.47
5.4.10.0170.05716.44
5.4.00.0030.06315.80
5.3.290.0070.04314.63
5.3.280.0130.05714.70
5.3.270.0030.07014.71
5.3.260.0030.08314.68
5.3.250.0070.04314.55
5.3.240.0030.04714.68
5.3.230.0130.07014.68
5.3.220.0070.07314.51
5.3.210.0200.06314.59
5.3.200.0130.07014.71
5.3.190.0030.08314.67
5.3.180.0130.07014.50
5.3.170.0100.06014.64
5.3.160.0100.06314.60
5.3.150.0070.06714.68
5.3.140.0000.07714.52
5.3.130.0000.05714.70
5.3.120.0030.04014.62
5.3.110.0030.07014.66
5.3.100.0030.06014.11
5.3.90.0130.03013.98
5.3.80.0030.05314.00
5.3.70.0100.07014.05
5.3.60.0070.07714.04
5.3.50.0070.03713.85
5.3.40.0100.04314.02
5.3.30.0070.04713.82
5.3.20.0030.05313.71
5.3.10.0000.06013.68
5.3.00.0100.03713.75
5.2.170.0130.03311.31
5.2.160.0130.05011.31
5.2.150.0030.06011.31
5.2.140.0100.05711.31
5.2.130.0000.03711.31
5.2.120.0100.03011.31
5.2.110.0000.03711.31
5.2.100.0030.06711.31
5.2.90.0030.06011.31
5.2.80.0000.04011.31
5.2.70.0000.03711.31
5.2.60.0100.03311.31
5.2.50.0000.06311.31
5.2.40.0030.05311.31
5.2.30.0000.04311.31
5.2.20.0100.04711.31
5.2.10.0030.03311.31
5.2.00.0170.02711.31
5.1.60.0000.03011.31
5.1.50.0030.05011.31
5.1.40.0030.03311.31
5.1.30.0000.04011.31
5.1.20.0030.06011.31
5.1.10.0070.05711.31
5.1.00.0070.04311.31
5.0.50.0000.05311.31
5.0.40.0030.04311.31
5.0.30.0030.06311.31
5.0.20.0100.01711.31
5.0.10.0030.04311.31
5.0.00.0000.05311.31
4.4.90.0030.02011.31
4.4.80.0000.03011.31
4.4.70.0000.03311.31
4.4.60.0000.03011.31
4.4.50.0000.03011.31
4.4.40.0030.05711.31
4.4.30.0000.02711.31
4.4.20.0000.03311.31
4.4.10.0030.03711.31
4.4.00.0030.05711.31
4.3.110.0070.03011.31
4.3.100.0000.03711.31
4.3.90.0030.03711.31
4.3.80.0030.05011.31
4.3.70.0070.03011.31
4.3.60.0030.03011.31
4.3.50.0030.02311.31
4.3.40.0030.02711.31
4.3.30.0000.03711.31
4.3.20.0000.04311.31
4.3.10.0030.03011.31
4.3.00.0000.04011.31

preferences:
37.16 ms | 401 KiB | 5 Q