3v4l.org

run code in 300+ PHP versions simultaneously
<?php function get_age($date, $units='years') { $modifier = date('n') - date('n', strtotime($date)) ? 1 : (date('j') - date('j', strtotime($date)) ? 1 : 0); $seconds = (time()-strtotime($date)); $years = (date('Y')-date('Y', strtotime($date))-$modifier); switch($units) { case 'seconds': return $seconds; case 'minutes': return round($seconds/60); case 'hours': return round($seconds/60/60); case 'days': return round($seconds/60/60/24); case 'months': return ($years*12+date('n')); case 'decades': return ($years/10); case 'centuries': return ($years/100); case 'years': default: return $years; } } echo 'I am '.get_age('September 19th, 1984', 'days').' days old';

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.2.00.0030.00719.06
7.1.100.0080.00418.13
7.1.70.0000.00817.12
7.1.60.0960.00415.41
7.1.50.0060.01617.01
7.1.00.0000.07722.43
7.0.200.0100.00717.06
7.0.140.0000.07322.08
7.0.90.0030.08021.74
7.0.80.0000.08321.80
7.0.70.0070.06021.76
7.0.60.0030.08021.77
7.0.50.0100.07722.10
7.0.40.0030.08020.15
7.0.30.0100.07720.18
7.0.20.0030.08320.04
7.0.10.0070.07720.04
7.0.00.0030.06320.12
5.6.280.0070.07021.16
5.6.240.0070.08020.77
5.6.230.0100.08020.64
5.6.220.0030.08320.59
5.6.210.0100.07320.66
5.6.200.0030.08721.12
5.6.190.0030.06021.00
5.6.180.0100.07721.05
5.6.170.0070.08021.07
5.6.160.0100.08020.96
5.6.150.0100.05721.09
5.6.140.0130.06320.93
5.6.130.0000.06721.04
5.6.120.0200.06321.11
5.6.110.0070.06721.08
5.6.100.0100.04720.95
5.6.90.0070.05321.09
5.6.80.0000.05020.36
5.6.70.0000.08720.35
5.6.60.0100.04320.29
5.6.50.0070.07320.34
5.6.40.0100.08020.38
5.6.30.0070.07320.41
5.6.20.0100.06720.50
5.6.10.0030.05020.39
5.6.00.0100.07020.36
5.5.380.0030.08720.48
5.5.370.0100.07320.38
5.5.360.0030.05320.54
5.5.350.0030.08320.40
5.5.340.0030.08720.91
5.5.330.0070.07320.81
5.5.320.0070.04320.91
5.5.310.0070.08020.89
5.5.300.0100.06320.77
5.5.290.0030.08320.90
5.5.280.0000.05320.84
5.5.270.0030.07720.89
5.5.260.0070.07020.80
5.5.250.0030.07720.72
5.5.240.0000.05720.29
5.5.230.0030.05320.07
5.5.220.0070.05020.31
5.5.210.0100.08020.27
5.5.200.0070.05720.14
5.5.190.0100.07720.22
5.5.180.0070.07020.29
5.5.160.0070.07320.27
5.5.150.0100.05320.24
5.5.140.0100.07720.16
5.5.130.0000.04320.13
5.5.120.0100.07020.04
5.5.110.0000.07320.19
5.5.100.0030.07320.17
5.5.90.0030.04320.02
5.5.80.0000.08720.17
5.5.70.0000.04720.10
5.5.60.0070.06320.07
5.5.50.0070.07320.07
5.5.40.0100.06720.15
5.5.30.0030.07020.04
5.5.20.0030.07720.08
5.5.10.0000.08019.98
5.5.00.0030.07720.13
5.4.450.0130.07019.54
5.4.440.0030.05319.34
5.4.430.0070.07319.33
5.4.420.0070.05019.41
5.4.410.0100.07319.20
5.4.400.0070.07019.23
5.4.390.0070.07019.13
5.4.380.0030.07719.13
5.4.370.0170.05719.03
5.4.360.0100.06319.21
5.4.350.0070.07319.01
5.4.340.0170.06719.04
5.4.320.0130.06719.01
5.4.310.0130.06318.96
5.4.300.0030.07018.93
5.4.290.0030.05019.00
5.4.280.0130.07319.29
5.4.270.0000.04319.14
5.4.260.0070.04019.21
5.4.250.0030.07719.12
5.4.240.0100.04019.11
5.4.230.0070.06719.17
5.4.220.0070.04319.13
5.4.210.0070.04718.91
5.4.200.0030.04319.29
5.4.190.0130.06719.18
5.4.180.0030.07319.20
5.4.170.0000.08018.89
5.4.160.0130.06319.07
5.4.150.0100.07019.09
5.4.140.0100.06716.51
5.4.130.0070.06016.46
5.4.120.0030.05316.39
5.4.110.0030.07016.32
5.4.100.0070.06716.54
5.4.90.0030.05316.56
5.4.80.0100.06316.54
5.4.70.0070.06716.43
5.4.60.0100.03316.47
5.4.50.0070.07016.45
5.4.40.0000.04316.60
5.4.30.0100.03316.41
5.4.20.0070.06716.42
5.4.10.0030.05716.37
5.4.00.0030.04715.75
5.3.290.0070.07014.70
5.3.280.0000.04314.66
5.3.270.0030.06014.65
5.3.260.0030.05714.67
5.3.250.0100.05314.74
5.3.240.0030.07714.74
5.3.230.0070.07014.73
5.3.220.0070.07014.67
5.3.210.0070.07014.59
5.3.200.0100.04014.61
5.3.190.0070.04014.64
5.3.180.0030.07314.59
5.3.170.0030.04014.62
5.3.160.0030.04314.67
5.3.150.0030.07714.61
5.3.140.0000.07314.66
5.3.130.0100.07014.59
5.3.120.0000.05714.67
5.3.110.0070.07014.54
5.3.100.0070.07314.19
5.3.90.0030.07314.05
5.3.80.0000.06714.06
5.3.70.0100.07014.02
5.3.60.0030.06713.95
5.3.50.0000.07313.95
5.3.40.0130.06713.89
5.3.30.0000.05714.05
5.3.20.0070.07013.79
5.3.10.0030.04013.57
5.3.00.0030.06713.75
5.2.170.0000.04711.31
5.2.160.0030.05311.39
5.2.150.0030.05711.31
5.2.140.0000.06311.31
5.2.130.0100.05711.37
5.2.120.0070.05011.23
5.2.110.0030.05711.44
5.2.100.0000.06311.20
5.2.90.0000.04711.33
5.2.80.0100.04711.35
5.2.70.0000.05711.36
5.2.60.0030.03711.07
5.2.50.0000.06711.14
5.2.40.0030.04311.19
5.2.30.0030.05711.13
5.2.20.0070.03711.05
5.2.10.0000.06011.09
5.2.00.0000.04010.85
5.1.60.0170.01710.13
5.1.50.0030.05010.05
5.1.40.0000.05010.26
5.1.30.0030.05710.59
5.1.20.0000.06310.61
5.1.10.0030.05310.27
5.1.00.0000.05310.33
5.0.50.0070.0408.90
5.0.40.0000.0478.90
5.0.30.0070.0578.90
5.0.20.0030.0378.90
5.0.10.0070.0378.90
5.0.00.0070.0608.90
4.4.90.0030.0338.90
4.4.80.0030.0308.90
4.4.70.0030.0338.90
4.4.60.0000.0278.90
4.4.50.0030.0308.90
4.4.40.0000.0538.90
4.4.30.0000.0338.90
4.4.20.0000.0278.90
4.4.10.0000.0378.90
4.4.00.0000.0578.90
4.3.110.0030.0338.90
4.3.100.0030.0308.90
4.3.90.0000.0308.90
4.3.80.0000.0308.90
4.3.70.0030.0338.90
4.3.60.0000.0308.90
4.3.50.0000.0238.90
4.3.40.0070.0538.90
4.3.30.0070.0178.90
4.3.20.0030.0378.90
4.3.10.0000.0378.90
4.3.00.0070.0138.90

preferences:
40.25 ms | 401 KiB | 5 Q