3v4l.org

run code in 300+ PHP versions simultaneously
<?php namespace Zend\Stdlib { use DateTimeZone; class DateTime extends \DateTime { public function __construct($time = 'now', $timezone = null) { // workaround not required for PHP 5.3.7 or newer if(version_compare(PHP_VERSION, '5.3.7','>=')){ return parent::__construct($time, $timezone); } // Check if using relative constructs if(!stristr($time, 'last') && !stristr($time, 'first')){ return parent::__construct($time, $timezone); } // Use current time with constructor to prevent setting 'first_last_day_of' flag parent::__construct('now', $timezone); // Set the timestamp by relying on strtotime and avoiding setting the // internal 'first_last_day_of' flag of DateTime object. $this->setTimestamp( strtotime($time, $this->getTimestamp()) ); return $this; } public function modify($modify) { // Workaround not required for PHP 5.3.7 or newer if(version_compare(PHP_VERSION, '5.3.7','>=')){ return parent::modify($modify); } // Check if using relative constructs if(!stristr($modify, 'last') && !stristr($modify, 'first')){ return parent::modify($modify); } // Set the timestamp by relying on strtotime and avoiding setting the // internal 'first_last_day_of' flag of DateTime object. $parsedTimestamp = strtotime($modify, $this->getTimestamp()); if ($parsedTimestamp === false) { return false; // something went wrong parsing the date } $this->setTimestamp($parsedTimestamp); return $this; } } $interval = new DateInterval('P1D'); $dt = new \DateTime('2012-05-05'); var_dump($dt); $dt->add($interval); var_dump($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)
8.3.40.0180.00018.79
8.3.30.0110.00319.08
8.3.20.0050.00220.25
8.3.10.0080.00023.48
8.3.00.0050.00320.52
8.2.170.0070.00722.96
8.2.160.0070.00720.32
8.2.150.0080.00024.18
8.2.140.0040.01524.66
8.2.130.0080.00026.16
8.2.120.0080.00022.10
8.2.110.0040.00422.18
8.2.100.0060.00617.72
8.2.90.0040.00419.08
8.2.80.0040.00417.97
8.2.70.0060.00317.47
8.2.60.0000.00917.80
8.2.50.0060.00318.07
8.2.40.0080.00017.92
8.2.30.0000.00817.88
8.2.20.0050.00217.66
8.2.10.0040.00417.68
8.2.00.0050.00317.74
8.1.270.0030.00523.79
8.1.260.0080.00026.35
8.1.250.0080.00028.09
8.1.240.0060.00323.96
8.1.230.0070.00319.16
8.1.220.0000.00917.74
8.1.210.0040.00418.77
8.1.200.0060.00317.35
8.1.190.0000.00817.41
8.1.180.0080.00018.10
8.1.170.0040.00418.59
8.1.160.0050.00222.07
8.1.150.0040.00418.44
8.1.140.0050.00217.20
8.1.130.0000.00717.77
8.1.120.0040.00317.36
8.1.110.0040.00417.38
8.1.100.0040.00417.31
8.1.90.0040.00417.19
8.1.80.0000.00717.33
8.1.70.0030.00317.20
8.1.60.0080.00317.46
8.1.50.0090.00017.50
8.1.40.0030.00617.49
8.1.30.0000.00817.56
8.1.20.0030.00517.48
8.1.10.0040.00417.57
8.1.00.0040.00417.45
8.0.300.0070.00018.77
8.0.290.0070.00017.05
8.0.280.0030.00318.30
8.0.270.0040.00417.09
8.0.260.0050.00316.73
8.0.250.0030.00316.97
8.0.240.0000.00716.94
8.0.230.0070.00016.93
8.0.220.0020.00516.86
8.0.210.0000.00716.86
8.0.200.0000.00716.95
8.0.190.0030.00616.94
8.0.180.0050.00216.92
8.0.170.0000.00816.83
8.0.160.0020.00516.83
8.0.150.0040.00416.74
8.0.140.0030.00316.84
8.0.130.0030.00313.41
8.0.120.0040.00416.83
8.0.110.0040.00416.73
8.0.100.0080.00016.88
8.0.90.0000.00716.88
8.0.80.0100.01016.95
8.0.70.0030.00616.94
8.0.60.0030.00516.96
8.0.50.0040.00416.85
8.0.30.0140.00817.10
8.0.20.0100.00917.40
8.0.10.0050.00216.89
8.0.00.0130.00616.53
7.4.330.0000.00515.00
7.4.320.0000.00616.28
7.4.300.0030.00316.46
7.4.290.0040.00416.55
7.4.280.0040.00416.45
7.4.270.0070.00016.60
7.4.260.0080.00016.54
7.4.250.0000.00716.39
7.4.240.0020.00616.49
7.4.230.0020.00516.47
7.4.220.0110.01416.34
7.4.210.0100.00616.55
7.4.200.0030.00416.60
7.4.190.0000.00816.44
7.4.160.0100.00616.28
7.4.150.0140.00317.40
7.4.140.0080.01217.86
7.4.130.0110.00616.54
7.4.120.0050.01116.55
7.4.110.0110.00716.51
7.4.100.0170.00716.41
7.4.90.0120.00616.39
7.4.80.0110.00716.57
7.4.70.0130.00316.50
7.4.60.0070.01716.57
7.4.50.0050.00316.36
7.4.40.0000.01722.77
7.4.30.0000.02216.50
7.4.00.0070.01315.00
7.3.330.0060.00013.30
7.3.320.0060.00013.30
7.3.310.0030.00516.34
7.3.300.0000.00716.28
7.3.290.0110.00316.32
7.3.280.0060.01216.26
7.3.270.0090.00917.40
7.3.260.0050.01116.33
7.3.250.0110.00816.41
7.3.240.0160.00616.38
7.3.230.0000.01716.49
7.3.210.0030.01516.61
7.3.200.0180.00319.39
7.3.190.0100.01016.28
7.3.180.0090.00616.29
7.3.170.0100.00716.33
7.3.160.0090.00616.45
7.3.120.0100.00714.85
7.2.330.0140.00316.56
7.2.320.0090.00916.32
7.2.310.0160.00716.58
7.2.300.0030.01416.32
7.2.290.0100.00616.45
7.2.60.0030.01016.82
7.2.00.0100.00319.32
7.1.200.0030.01015.59
7.1.100.0030.00918.02
7.1.70.0070.00216.89
7.1.60.0030.01919.29
7.1.50.0070.01716.77
7.1.00.0030.07722.48
7.0.200.0030.00616.74
7.0.140.0000.10022.08
7.0.100.0070.05019.89
7.0.90.0030.07019.98
7.0.80.0100.07719.97
7.0.70.0100.08019.98
7.0.60.0030.08719.93
7.0.50.0200.03720.34
7.0.40.0130.08020.08
7.0.30.0070.07020.09
7.0.20.0070.08320.00
7.0.10.0070.05720.09
7.0.00.0070.09020.17
5.6.280.0030.07321.14
5.6.250.0030.06020.51
5.6.240.0130.03720.52
5.6.230.0030.08020.62
5.6.220.0030.07720.59
5.6.210.0100.08720.71
5.6.200.0030.06021.12
5.6.190.0070.07021.13
5.6.180.0100.07721.02
5.6.170.0100.08021.10
5.6.160.0070.08721.17
5.6.150.0100.04020.96
5.6.140.0130.07721.08
5.6.130.0030.04721.00
5.6.120.0130.06321.08
5.6.110.0100.06721.07
5.6.100.0100.08020.94
5.6.90.0170.07320.99
5.6.80.0000.08320.33
5.6.70.0030.05020.43
5.6.60.0070.08020.45
5.6.50.0100.08020.50
5.6.40.0030.07720.43
5.6.30.0030.08320.42
5.6.20.0030.06320.36
5.6.10.0130.07020.32
5.6.00.0200.06320.45
5.5.380.0130.06720.39
5.5.370.0030.08020.39
5.5.360.0100.08320.31
5.5.350.0070.07720.32
5.5.340.0100.07720.89
5.5.330.0170.06320.84
5.5.320.0000.08320.90
5.5.310.0030.07720.88
5.5.300.0070.07720.85
5.5.290.0100.05720.76
5.5.280.0170.08020.89
5.5.270.0070.08020.65
5.5.260.0070.08020.80
5.5.250.0130.07320.71
5.5.240.0030.04020.26
5.5.230.0000.07720.21
5.5.220.0100.06320.29
5.5.210.0070.06020.23
5.5.200.0070.06720.06
5.5.190.0070.05020.23
5.5.180.0230.05320.18
5.5.160.0100.05020.17
5.5.150.0130.03320.25
5.5.140.0030.05020.09
5.5.130.0170.07320.18
5.5.120.0030.06020.16
5.5.110.0100.05020.17
5.5.100.0030.04720.06
5.5.90.0030.05020.15
5.5.80.0070.03720.11
5.5.70.0070.05320.04
5.5.60.0130.06720.01
5.5.50.0030.06320.04
5.5.40.0100.04020.09
5.5.30.0000.06320.07
5.5.20.0030.06720.16
5.5.10.0030.06020.07
5.5.00.0100.07020.14
5.4.450.0070.07019.43
5.4.440.0000.08319.45
5.4.430.0030.08319.54
5.4.420.0030.05019.45
5.4.410.0100.05019.23
5.4.400.0170.07018.88
5.4.390.0100.07718.91
5.4.380.0030.07318.95
5.4.370.0070.07319.01
5.4.360.0030.07319.23
5.4.350.0100.06719.13
5.4.340.0100.06719.22
5.4.320.0070.05019.18
5.4.310.0070.05319.03
5.4.300.0100.05718.98
5.4.290.0070.04719.03
5.4.280.0170.05318.85
5.4.270.0070.06019.12
5.4.260.0030.05719.13
5.4.250.0100.07319.02
5.4.240.0000.05719.04
5.4.230.0100.03719.13
5.4.220.0000.04319.12
5.4.210.0070.04319.21
5.4.200.0070.03718.84
5.4.190.0030.08019.12
5.4.180.0100.04318.86
5.4.170.0030.07318.84
5.4.160.0030.08018.90
5.4.150.0070.07018.85
5.4.140.0070.08716.38
5.4.130.0030.04316.40
5.4.120.0070.06716.36
5.4.110.0000.04316.29
5.4.100.0170.06716.49
5.4.90.0100.06316.50
5.4.80.0030.05016.27
5.4.70.0030.04316.49
5.4.60.0100.06016.33
5.4.50.0170.03716.41
5.4.40.0000.04016.38
5.4.30.0030.03716.27
5.4.20.0130.06016.30
5.4.10.0070.05716.33
5.4.00.0070.06315.80
5.3.290.0130.04314.69
5.3.280.0000.04014.66
5.3.270.0070.06314.54
5.3.260.0100.03014.60
5.3.250.0030.03314.73
5.3.240.0070.05714.76
5.3.230.0070.05314.72
5.3.220.0070.06714.53
5.3.210.0130.03714.59
5.3.200.0070.07314.70
5.3.190.0070.07314.54
5.3.180.0000.07714.64
5.3.170.0070.05714.55
5.3.160.0070.04714.64
5.3.150.0000.04714.52
5.3.140.0030.06314.59
5.3.130.0070.04014.51
5.3.120.0130.05014.55
5.3.110.0130.05314.55
5.3.100.0000.05314.11
5.3.90.0100.03014.17
5.3.80.0100.06714.15
5.3.70.0030.03313.96
5.3.60.0100.04714.04
5.3.50.0070.03013.90
5.3.40.0070.03713.89
5.3.30.0130.06013.88
5.3.20.0070.04013.73
5.3.10.0000.04713.56
5.3.00.0130.06313.64
5.2.170.0000.03011.17
5.2.160.0000.03010.94
5.2.150.0030.04311.10
5.2.140.0030.03310.99
5.2.130.0130.05311.05
5.2.120.0000.03010.97
5.2.110.0000.03010.96
5.2.100.0070.05011.08
5.2.90.0000.04711.10
5.2.80.0070.06011.05
5.2.70.0070.06311.13
5.2.60.0030.06310.84
5.2.50.0030.04710.98
5.2.40.0030.03011.04
5.2.30.0070.03010.99
5.2.20.0070.05710.91
5.2.10.0070.03310.93
5.2.00.0070.06010.75
5.1.60.0100.03310.06
5.1.50.0000.0539.98
5.1.40.0100.02710.03
5.1.30.0000.05010.39
5.1.20.0030.05710.27
5.1.10.0030.04010.09
5.1.00.0070.0509.95
5.0.50.0100.0338.55
5.0.40.0030.0338.27
5.0.30.0070.0408.32
5.0.20.0030.0378.19
5.0.10.0000.0478.23
5.0.00.0000.0708.22
4.4.90.0030.0337.82
4.4.80.0000.0237.82
4.4.70.0030.0207.82
4.4.60.0000.0377.82
4.4.50.0000.0377.82
4.4.40.0030.0607.82
4.4.30.0030.0277.82
4.4.20.0030.0237.82
4.4.10.0030.0207.82
4.4.00.0000.0607.82
4.3.110.0000.0377.82
4.3.100.0030.0337.82
4.3.90.0000.0377.82
4.3.80.0000.0577.82
4.3.70.0000.0207.82
4.3.60.0070.0337.82
4.3.50.0030.0337.82
4.3.40.0100.0437.82
4.3.30.0000.0407.82
4.3.20.0030.0337.82
4.3.10.0000.0337.82
4.3.00.0000.0377.82

preferences:
39.28 ms | 400 KiB | 5 Q