3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Blar_DateTime extends DateTime { /** * Return Date in ISO8601 format * * @return String */ public function __toString() { return $this->format('Y-m-d H:i'); } /** * Return difference between $this and $now * * @param Datetime|String $now * @return DateInterval */ public function diff($now = 'NOW') { if(!($now instanceOf DateTime)) { $now = new DateTime($now); } return parent::diff($now); } /** * Return Age in Years * * @param Datetime|String $now * @return Integer */ public function getAge($now = 'NOW') { return $this->diff($now)->format('%y'); } } $birthday = new Blar_DateTime('1879-03-14'); // Example 1 echo $birthday; // Result: 1879-03-14 00:00 // Example 2 echo '<p>Albert Einstein would now be ', $birthday->getAge(), ' years old.</p>'; // Result: <p>Albert Einstein would now be 130 years old.</p> // Example 3 echo '<p>Albert Einstein would now be ', $birthday->diff()->format('%y Years, %m Months, %d Days'), ' old.</p>'; // Result: <p>Albert Einstein would now be 130 Years, 10 Months, 10 Days old.</p> // Example 4 echo '<p>Albert Einstein was on 2010-10-10 ', $birthday->getAge('2010-10-10'), ' years old.</p>'; // Result: <p>Albert Einstein was on 2010-10-10 131 years old.</p>

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)
8.3.60.0110.00718.31
8.3.50.0130.00522.02
8.3.40.0150.00018.67
8.3.30.0100.00319.09
8.3.20.0050.00220.27
8.3.10.0000.00821.91
8.3.00.0000.00822.24
8.2.180.0120.00316.32
8.2.170.0090.00922.96
8.2.160.0090.00620.91
8.2.150.0040.00424.18
8.2.140.0050.00324.66
8.2.130.0080.00026.16
8.2.120.0030.00720.70
8.2.110.0100.00022.19
8.2.100.0070.00318.58
8.1.280.0070.00725.92
8.1.270.0080.00022.01
8.1.260.0040.00426.35
8.1.250.0070.00028.09
8.1.240.0030.00618.48
8.1.230.0070.00318.48
7.3.100.0060.01014.89
7.3.90.0060.00914.61
7.3.80.0130.00614.47
7.3.70.0120.00314.34
7.3.60.0090.00914.68
7.3.50.0130.00314.43
7.3.40.0070.01014.39
7.3.30.0040.01314.23
7.3.20.0100.01014.25
7.3.10.0120.00614.61
7.3.00.0040.01114.52
7.2.230.0110.00514.70
7.2.220.0040.01414.96
7.2.210.0090.01214.70
7.2.200.0160.00714.91
7.2.190.0070.01314.62
7.2.180.0090.00914.77
7.2.170.0100.00914.57
7.2.160.0070.01014.94
7.2.150.0030.01114.54
7.2.140.0090.01114.74
7.2.130.0070.01314.78
7.2.120.0030.01014.74
7.2.110.0090.01114.72
7.2.100.0080.00814.87
7.2.90.0060.01014.79
7.2.80.0130.00914.85
7.2.70.0120.00614.68
7.2.60.0100.00614.74
7.2.50.0070.01114.80
7.2.40.0070.00714.93
7.2.30.0080.00814.87
7.2.20.0090.00614.87
7.2.10.0090.00614.91
7.2.00.0290.00614.71
7.1.320.0080.00513.59
7.1.310.0110.01113.91
7.1.300.0130.01013.45
7.1.290.0110.00413.72
7.1.280.0070.00713.64
7.1.270.0070.01113.47
7.1.260.0090.00613.70
7.1.250.0110.00313.91
7.1.240.0140.00713.46
7.1.230.0130.00813.71
7.1.220.0080.01313.55
7.1.210.0090.00813.52
7.1.200.0130.01013.62
7.1.190.0080.01113.21
7.1.180.0170.00313.32
7.1.170.0140.00013.47
7.1.160.0080.01313.43
7.1.150.0090.01213.75
7.1.140.0180.00013.14
7.1.130.0090.00813.63
7.1.120.0120.00613.48
7.1.110.0120.00913.77
7.1.100.0140.01113.51
7.1.90.0150.00613.89
7.1.80.0180.00313.60
7.1.70.0180.00913.71
7.1.60.0120.00913.84
7.1.50.0040.01613.60
7.1.40.0170.00413.79
7.1.30.0130.00513.57
7.1.20.0130.00413.57
7.1.10.0120.00813.77
7.1.00.0090.00913.63
7.0.330.0120.00813.30
7.0.320.0070.01113.30
7.0.310.0150.00613.10
7.0.300.0060.00912.94
7.0.290.0090.01313.15
7.0.280.0060.01213.08
7.0.270.0070.01413.38
7.0.260.0140.00513.36
7.0.250.0120.00813.30
7.0.240.0210.01513.57
7.0.230.0090.01313.46
7.0.220.0170.00513.46
7.0.210.0130.00713.36
7.0.200.0100.01213.59
7.0.190.0180.00213.52
7.0.180.0200.00013.50
7.0.170.0110.00713.34
7.0.160.0120.00613.39
7.0.150.0130.00613.28
7.0.140.0090.00913.35
7.0.130.0290.00413.63
7.0.120.0120.00213.36
7.0.110.0060.01113.43
7.0.100.0090.01213.43
7.0.90.0100.00513.37
7.0.80.0080.00813.32
7.0.70.0080.00813.37
7.0.60.0120.00613.32
7.0.50.0080.00813.41
7.0.40.0170.00413.43
7.0.30.0160.00913.60
7.0.20.0170.00613.70
7.0.10.0090.04916.71
7.0.00.0120.04816.75
5.6.400.0110.01114.16
5.6.390.0080.01213.85
5.6.380.0120.01214.03
5.6.370.0080.01213.88
5.6.360.0160.00714.15
5.6.350.0080.01114.18
5.6.340.0080.00814.13
5.6.330.0120.01213.92
5.6.320.0180.00714.09
5.6.310.0120.00914.21
5.6.300.0110.00814.32
5.6.290.0110.00414.08
5.6.280.0040.01614.09
5.6.270.0040.01614.01
5.6.260.0110.00714.11
5.6.250.0120.00614.14
5.6.240.0120.00313.91
5.6.230.0070.01414.09
5.6.220.0080.00814.20
5.6.210.0070.01014.11
5.6.200.0130.00714.21
5.6.190.0180.00713.91
5.6.180.0160.01314.15
5.6.170.0160.00814.19
5.6.160.0110.02517.46
5.6.150.0070.04917.50
5.6.140.0120.04317.57
5.6.130.0090.04517.51
5.6.120.0150.03517.72
5.6.110.0180.04017.56
5.6.100.0140.04517.59
5.6.90.0070.05117.47
5.6.80.0100.04417.28
5.6.70.0120.04117.17
5.6.60.0110.03417.20
5.6.50.0110.04617.24
5.6.40.0090.04217.18
5.6.30.0120.04117.15
5.6.20.0090.04717.25
5.6.10.0120.04117.18
5.6.00.0150.04017.11
5.5.380.0100.00913.79
5.5.370.0080.01313.68
5.5.360.0100.00713.86
5.5.350.0090.01313.63
5.5.340.0060.01213.96
5.5.330.0180.00313.72
5.5.320.0000.02213.71
5.5.310.0040.01613.80
5.5.300.0130.04217.49
5.5.290.0090.02817.58
5.5.280.0110.04617.44
5.5.270.0140.04417.33
5.5.260.0120.04217.42
5.5.250.0170.02517.41
5.5.240.0150.02717.00
5.5.230.0110.02817.02
5.5.220.0120.04217.10
5.5.210.0070.04716.92
5.5.200.0090.03417.06
5.5.190.0090.04116.99
5.5.180.0120.04116.98
5.5.170.0090.01213.87
5.5.160.0130.04517.09
5.5.150.0080.04716.94
5.5.140.0100.04416.88
5.5.130.0120.04216.83
5.5.120.0090.04317.01
5.5.110.0110.04417.03
5.5.100.0070.04716.82
5.5.90.0040.04816.89
5.5.80.0090.02316.95
5.5.70.0080.03116.95
5.5.60.0120.02117.13
5.5.50.0120.03216.86
5.5.40.0110.04316.79
5.5.30.0120.04216.97
5.5.20.0110.03417.16
5.5.10.0090.04516.92
5.5.00.0070.03616.96
5.4.450.0090.03815.19
5.4.440.0100.03915.40
5.4.430.0120.04015.41
5.4.420.0080.04815.24
5.4.410.0100.04115.27
5.4.400.0130.03514.92
5.4.390.0130.04015.21
5.4.380.0050.04614.88
5.4.370.0120.03715.00
5.4.360.0110.04215.04
5.4.350.0080.04214.99
5.4.340.0090.04114.95
5.4.330.0130.00611.04
5.4.320.0070.03715.11
5.4.310.0090.04214.87
5.4.300.0050.03615.11
5.4.290.0050.02514.86
5.4.280.0150.03714.98
5.4.270.0120.02814.96
5.4.260.0080.03615.12
5.4.250.0090.03514.95
5.4.240.0100.02314.90
5.4.230.0040.04614.96
5.4.220.0080.02015.01
5.4.210.0080.04214.93
5.4.200.0080.03715.00
5.4.190.0130.03414.96
5.4.180.0100.03815.04
5.4.170.0120.03715.14
5.4.160.0140.03815.07
5.4.150.0110.03914.91
5.4.140.0060.04413.85
5.4.130.0060.04513.62
5.4.120.0070.04413.82
5.4.110.0100.02913.80
5.4.100.0080.03413.76
5.4.90.0100.03613.84
5.4.80.0100.03513.69
5.4.70.0130.02613.81
5.4.60.0120.02813.84
5.4.50.0060.02513.87
5.4.40.0100.03213.82
5.4.30.0060.04113.78
5.4.20.0090.04213.86
5.4.10.0100.03713.72
5.4.00.0050.04213.48
5.3.290.0120.04012.69
5.3.280.0140.03912.78
5.3.270.0070.04512.73
5.3.260.0060.03812.73
5.3.250.0080.02512.64
5.3.240.0070.02512.71
5.3.230.0080.04112.68
5.3.220.0070.03412.68
5.3.210.0140.04012.49
5.3.200.0100.03012.62
5.3.190.0090.02912.70
5.3.180.0120.03712.66
5.3.170.0050.04512.78
5.3.160.0100.02212.69
5.3.150.0120.03112.78
5.3.140.0120.03012.76
5.3.130.0150.02612.69
5.3.120.0110.02112.66
5.3.110.0120.03812.63
5.3.100.0020.04112.33
5.3.90.0060.03912.43
5.3.80.0120.03912.38
5.3.70.0080.02712.23
5.3.60.0080.03312.38
5.3.50.0110.02812.38
5.3.40.0030.03512.28
5.3.30.0090.03412.46
5.3.20.0050.03612.14
5.3.10.0050.03512.06
5.3.00.0070.04012.08
5.2.170.0070.02010.81
5.2.160.0070.01610.78
5.2.150.0040.02610.79
5.2.140.0030.03510.75
5.2.130.0110.02710.71
5.2.120.0020.03010.69
5.2.110.0060.01810.69
5.2.100.0070.01810.69
5.2.90.0030.02510.69
5.2.80.0070.02510.69
5.2.70.0030.02510.69
5.2.60.0040.02410.69
5.2.50.0030.03210.69
5.2.40.0020.03210.70
5.2.30.0050.01810.69
5.2.20.0060.03410.69
5.2.10.0060.02510.69
5.2.00.0080.01410.69
5.1.60.0010.03110.69
5.1.50.0050.01410.69
5.1.40.0050.02510.69
5.1.30.0060.02110.69
5.1.20.0070.01510.69
5.1.10.0040.02910.69
5.1.00.0050.01710.69
5.0.50.0070.01710.69
5.0.40.0060.02110.69
5.0.30.0030.02910.69
5.0.20.0020.02110.69
5.0.10.0040.01710.69
5.0.00.0070.03010.69
4.4.90.0020.01810.69
4.4.80.0020.01810.69
4.4.70.0030.01610.69
4.4.60.0030.02010.69
4.4.50.0080.01510.69
4.4.40.0030.02810.69
4.4.30.0020.02210.69
4.4.20.0000.02110.69
4.4.10.0010.01910.69
4.4.00.0030.03010.69
4.3.110.0000.01610.69
4.3.100.0040.01010.69
4.3.90.0050.01310.69
4.3.80.0020.01810.69
4.3.70.0040.01910.69
4.3.60.0040.01010.69
4.3.50.0050.00710.69
4.3.40.0020.01310.69
4.3.30.0020.00910.69
4.3.20.0050.00710.69
4.3.10.0020.01010.69
4.3.00.0030.00810.69

preferences:
40.85 ms | 401 KiB | 5 Q