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('first day of feb 2010'); 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.60.0070.00716.61
8.3.50.0130.00522.16
8.3.40.0040.01118.79
8.3.30.0110.00419.14
8.3.20.0040.00420.20
8.3.10.0040.00423.57
8.3.00.0000.00819.50
8.2.180.0130.00616.50
8.2.170.0110.01122.96
8.2.160.0140.00020.60
8.2.150.0050.00324.18
8.2.140.0000.00824.66
8.2.130.0040.00426.16
8.2.120.0080.00022.26
8.2.110.0030.00622.26
8.2.100.0090.00317.81
8.2.90.0050.00319.06
8.2.80.0040.00417.97
8.2.70.0000.00817.63
8.2.60.0040.00718.03
8.2.50.0080.00018.07
8.2.40.0030.00519.76
8.2.30.0040.00418.12
8.2.20.0000.00817.62
8.2.10.0000.00818.13
8.2.00.0000.00717.65
8.1.280.0060.00925.92
8.1.270.0040.00423.87
8.1.260.0050.00326.35
8.1.250.0000.00828.09
8.1.240.0060.00323.91
8.1.230.0080.00419.01
8.1.220.0030.00517.74
8.1.210.0040.00418.77
8.1.200.0060.00317.47
8.1.190.0000.00817.35
8.1.180.0000.00818.10
8.1.170.0000.00818.50
8.1.160.0040.00421.90
8.1.150.0000.00718.70
8.1.140.0040.00417.49
8.1.130.0000.00717.89
8.1.120.0070.00017.61
8.1.110.0030.00917.49
8.1.100.0040.00417.59
8.1.90.0030.00517.59
8.1.80.0000.00817.47
8.1.70.0070.00017.42
8.1.60.0050.00217.65
8.1.50.0050.00317.57
8.1.40.0020.00517.55
8.1.30.0000.00817.60
8.1.20.0000.00817.76
8.1.10.0040.00417.64
8.1.00.0050.00317.59
8.0.300.0040.00418.77
8.0.290.0030.00617.18
8.0.280.0040.00418.50
8.0.270.0080.00017.14
8.0.260.0020.00517.21
8.0.250.0030.00317.00
8.0.240.0030.00616.96
8.0.230.0040.00417.02
8.0.220.0030.00316.97
8.0.210.0000.00716.95
8.0.200.0000.00717.07
8.0.190.0000.00817.06
8.0.180.0040.00716.89
8.0.170.0000.00816.95
8.0.160.0040.00416.88
8.0.150.0000.00716.89
8.0.140.0050.00316.86
8.0.130.0000.00513.36
8.0.120.0000.00916.92
8.0.110.0000.00716.97
8.0.100.0070.00016.86
8.0.90.0000.00716.96
8.0.80.0090.00916.84
8.0.70.0040.00416.94
8.0.60.0070.00016.98
8.0.50.0040.00416.79
8.0.30.0160.00417.28
8.0.20.0100.00917.40
8.0.10.0000.00817.00
8.0.00.0150.00616.82
7.4.330.0000.00515.14
7.4.320.0080.00016.59
7.4.300.0030.00316.53
7.4.290.0040.00416.52
7.4.280.0000.00816.68
7.4.270.0000.00816.70
7.4.260.0000.00716.44
7.4.250.0040.00416.47
7.4.240.0050.00316.67
7.4.230.0030.00316.52
7.4.220.0070.01016.68
7.4.210.0080.00716.60
7.4.200.0000.00716.61
7.4.190.0070.00016.64
7.4.160.0040.01216.43
7.4.150.0090.00917.40
7.4.140.0130.00617.86
7.4.130.0090.01016.56
7.4.120.0030.01616.65
7.4.110.0060.01616.52
7.4.100.0060.01316.44
7.4.90.0100.01416.44
7.4.80.0080.01119.39
7.4.70.0070.01016.77
7.4.60.0120.00616.45
7.4.50.0000.00816.64
7.4.40.0050.01416.76
7.4.30.0080.00816.57
7.4.00.0030.01414.98
7.3.330.0030.00313.16
7.3.320.0000.00513.31
7.3.310.0000.00716.19
7.3.300.0030.00316.17
7.3.290.0040.01516.33
7.3.280.0040.01116.31
7.3.270.0120.00417.40
7.3.260.0100.00716.58
7.3.250.0120.00616.37
7.3.240.0200.00316.34
7.3.230.0110.00616.52
7.3.210.0060.01116.41
7.3.200.0080.01419.39
7.3.190.0150.00916.32
7.3.180.0070.01016.46
7.3.170.0070.01016.32
7.3.160.0060.01316.45
7.3.120.0100.00914.82
7.3.110.0050.01015.16
7.3.100.0040.01014.82
7.3.90.0050.00914.77
7.3.80.0060.00714.83
7.3.70.0030.01014.76
7.3.60.0060.00614.89
7.3.50.0080.00514.63
7.3.40.0020.00814.86
7.3.30.0080.00514.80
7.3.20.0060.00916.53
7.3.10.0100.00716.81
7.3.00.0080.00516.66
7.2.330.0070.01116.84
7.2.320.0100.00716.52
7.2.310.0080.01416.79
7.2.300.0060.01016.77
7.2.290.0110.00716.88
7.2.250.0070.01114.90
7.2.240.0120.00315.04
7.2.230.0050.01115.03
7.2.220.0060.00514.96
7.2.210.0100.00515.20
7.2.200.0030.00915.00
7.2.190.0030.01315.01
7.2.180.0070.00715.09
7.2.170.0060.00615.15
7.2.160.0000.01115.25
7.2.150.0100.01316.88
7.2.140.0100.01016.96
7.2.130.0140.00416.98
7.2.120.0100.00716.90
7.2.110.0120.00317.14
7.2.100.0090.00317.00
7.2.90.0060.00916.68
7.2.80.0060.00916.88
7.2.70.0030.00716.96
7.2.60.0120.00516.95
7.2.50.0030.01016.96
7.2.40.0030.01316.86
7.2.30.0030.01017.04
7.2.20.0020.01217.07
7.2.10.0030.01416.75
7.2.00.0090.00316.80
7.1.330.0050.01015.75
7.1.320.0080.00515.91
7.1.310.0020.00915.84
7.1.300.0030.00715.80
7.1.290.0040.00415.62
7.1.280.0060.00515.72
7.1.270.0030.00815.73
7.1.260.0000.01215.81
7.1.250.0120.00015.83
7.1.200.0080.00415.88
7.1.70.0030.00717.09
7.1.60.0120.01219.46
7.1.50.0130.01017.14
7.1.00.0000.08022.48
7.0.200.0030.00616.73
7.0.140.0000.07321.99
7.0.70.0000.04021.75
7.0.60.0030.07021.77
7.0.50.0130.08022.13
7.0.40.0000.04720.08
7.0.30.0030.08720.06
7.0.20.0100.08320.13
7.0.10.0000.09020.09
7.0.00.0070.08720.16
5.6.280.0030.07321.03
5.6.220.0030.06020.64
5.6.210.0030.08020.62
5.6.200.0030.08321.13
5.6.190.0030.06021.11
5.6.180.0070.06020.95
5.6.170.0170.07321.12
5.6.160.0030.08021.07
5.6.150.0030.08320.96
5.6.140.0130.07021.03
5.6.130.0070.07021.15
5.6.120.0070.08321.05
5.6.110.0130.07321.11
5.6.100.0030.08320.96
5.6.90.0100.07720.95
5.6.80.0000.08020.47
5.6.70.0070.07020.45
5.6.60.0070.07720.36
5.6.50.0070.07720.53
5.6.40.0030.06020.55
5.6.30.0030.08020.55
5.6.20.0070.07720.41
5.6.10.0070.07020.48
5.6.00.0070.05020.40
5.5.360.0130.07320.58
5.5.350.0070.05720.36
5.5.340.0000.05020.84
5.5.330.0100.08020.90
5.5.320.0070.06020.95
5.5.310.0000.09020.92
5.5.300.0070.07720.91
5.5.290.0000.09020.79
5.5.280.0030.08720.85
5.5.270.0070.06320.79
5.5.260.0000.08020.84
5.5.250.0030.08720.47
5.5.240.0170.07020.34
5.5.230.0070.08020.23
5.5.220.0070.08020.23
5.5.210.0070.06320.16
5.5.200.0030.07720.15
5.5.190.0070.07020.00
5.5.180.0070.08320.13
5.5.160.0030.08020.25
5.5.150.0030.08320.00
5.5.140.0100.07320.19
5.5.130.0000.08320.16
5.5.120.0030.06320.30
5.5.110.0030.06020.19
5.5.100.0030.08020.00
5.5.90.0000.07720.19
5.5.80.0100.07720.11
5.5.70.0000.04020.17
5.5.60.0070.05720.11
5.5.50.0030.07720.18
5.5.40.0000.06020.16
5.5.30.0070.07319.95
5.5.20.0070.04720.16
5.5.10.0070.08720.11
5.5.00.0000.07720.06
5.4.450.0030.08319.38
5.4.440.0070.07019.54
5.4.430.0070.05719.20
5.4.420.0030.07719.41
5.4.410.0030.04319.05
5.4.400.0070.05319.13
5.4.390.0000.07719.14
5.4.380.0070.05319.18
5.4.370.0070.06019.09
5.4.360.0070.07319.15
5.4.350.0030.08019.05
5.4.340.0100.06719.14
5.4.320.0030.08319.16
5.4.310.0000.08018.90
5.4.300.0070.07319.04
5.4.290.0000.04718.84
5.4.280.0030.07719.22
5.4.270.0030.08019.13
5.4.260.0000.05019.23
5.4.250.0070.06019.20
5.4.240.0000.04319.19
5.4.230.0100.07019.23
5.4.220.0000.10318.92
5.4.210.0130.06718.86
5.4.200.0030.07719.20
5.4.190.0000.05719.11
5.4.180.0030.06019.04
5.4.170.0170.06718.94
5.4.160.0100.06718.88
5.4.150.0070.07318.93
5.4.140.0070.06316.55
5.4.130.0030.04316.41
5.4.120.0030.07316.38
5.4.110.0000.04316.56
5.4.100.0030.07716.49
5.4.90.0070.03316.55
5.4.80.0000.06316.36
5.4.70.0000.04016.36
5.4.60.0000.05016.45
5.4.50.0000.07716.43
5.4.40.0000.05016.53
5.4.30.0030.07016.33
5.4.20.0100.06716.47
5.4.10.0000.06016.44
5.4.00.0000.07015.86
5.3.290.0070.07314.74
5.3.280.0000.05314.54
5.3.270.0030.08014.55
5.3.260.0030.07714.60
5.3.250.0000.05014.64
5.3.240.0070.07314.63
5.3.230.0030.07714.54
5.3.220.0100.07014.62
5.3.210.0000.08014.69
5.3.200.0000.07314.64
5.3.190.0030.06314.60
5.3.180.0030.07014.70
5.3.170.0100.06014.59
5.3.160.0200.06314.67
5.3.150.0030.08014.53
5.3.140.0070.06314.56
5.3.130.0000.07714.61
5.3.120.0000.07714.57
5.3.110.0030.05314.49
5.3.100.0070.07713.98
5.3.90.0030.07314.04
5.3.80.0000.07314.04
5.3.70.0030.07713.95
5.3.60.0130.06713.92
5.3.50.0000.07313.95
5.3.40.0130.06714.05
5.3.30.0130.06313.82
5.3.20.0030.07013.61
5.3.10.0030.07013.66
5.3.00.0030.07013.77
5.2.170.0000.06712.26
5.2.160.0030.05712.26
5.2.150.0000.06312.26
5.2.140.0000.05712.26
5.2.130.0000.06312.26
5.2.120.0030.04312.26
5.2.110.0000.06312.26
5.2.100.0030.04012.26
5.2.90.0100.04012.26
5.2.80.0000.06012.26
5.2.70.0030.06712.26
5.2.60.0030.06312.26
5.2.50.0000.06012.26
5.2.40.0000.06312.26
5.2.30.0070.06012.26
5.2.20.0100.05312.26
5.2.10.0070.05712.26
5.2.00.0000.04712.26
5.1.60.0000.05312.26
5.1.50.0000.05712.26
5.1.40.0100.05012.26
5.1.30.0000.03012.26
5.1.20.0070.05712.26
5.1.10.0070.04712.26
5.1.00.0000.04012.26
5.0.50.0030.04012.26
5.0.40.0000.04712.26
5.0.30.0000.06712.26
5.0.20.0030.03312.26
5.0.10.0000.03312.26
5.0.00.0000.06312.26
4.4.90.0000.03712.26
4.4.80.0030.03312.26
4.4.70.0030.03312.26
4.4.60.0000.03712.26
4.4.50.0000.03712.26
4.4.40.0000.04012.26
4.4.30.0000.02312.26
4.4.20.0070.02012.26
4.4.10.0000.02712.26
4.4.00.0000.05712.26
4.3.110.0000.02712.26
4.3.100.0000.03312.26
4.3.90.0070.03012.26
4.3.80.0100.04712.26
4.3.70.0030.03012.26
4.3.60.0030.03312.26
4.3.50.0000.02712.26
4.3.40.0000.04712.26
4.3.30.0000.03012.26
4.3.20.0070.03712.26
4.3.10.0070.03012.26
4.3.00.0000.02712.26

preferences:
56.98 ms | 401 KiB | 5 Q