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.0090.01118.56
8.3.50.0070.00922.09
8.3.40.0040.01118.79
8.3.30.0070.00718.96
8.3.20.0020.00520.20
8.3.10.0040.00421.90
8.3.00.0000.00822.53
8.2.180.0060.01318.66
8.2.170.0100.01022.96
8.2.160.0070.00720.74
8.2.150.0080.00024.18
8.2.140.0080.00024.66
8.2.130.0150.00426.16
8.2.120.0000.00819.48
8.2.110.0170.00322.31
8.2.100.0130.00019.76
8.2.90.0040.00419.17
8.2.80.0050.00318.04
8.2.70.0040.00417.75
8.2.60.0040.00418.03
8.2.50.0030.00618.07
8.2.40.0040.00418.22
8.2.30.0040.00418.00
8.2.20.0030.00617.84
8.2.10.0000.00717.71
8.2.00.0040.00417.91
8.1.280.0100.01025.92
8.1.270.0050.00322.23
8.1.260.0040.00426.35
8.1.250.0000.00828.09
8.1.240.0090.00923.96
8.1.230.0070.00419.16
8.1.220.0050.00317.74
8.1.210.0040.00418.77
8.1.200.0000.00917.48
8.1.190.0000.00817.50
8.1.180.0060.00318.55
8.1.170.0060.00318.63
8.1.160.0000.00721.93
8.1.150.0030.00518.75
8.1.140.0040.00417.61
8.1.130.0050.00217.89
8.1.120.0030.00517.63
8.1.110.0020.00517.64
8.1.100.0040.00417.67
8.1.90.0030.00417.64
8.1.80.0040.00417.69
8.1.70.0000.00717.49
8.1.60.0090.00017.71
8.1.50.0060.00317.53
8.1.40.0060.00317.54
8.1.30.0000.00817.67
8.1.20.0050.00317.68
8.1.10.0050.00217.52
8.1.00.0050.00517.58
8.0.300.0040.00418.77
8.0.290.0000.00717.18
8.0.280.0040.00418.52
8.0.270.0030.00317.24
8.0.260.0000.00716.83
8.0.250.0000.00717.08
8.0.240.0000.00717.08
8.0.230.0030.00316.98
8.0.220.0040.00417.05
8.0.210.0000.00716.93
8.0.200.0000.00717.06
8.0.190.0080.00017.10
8.0.180.0110.00016.90
8.0.170.0070.00016.89
8.0.160.0000.00716.90
8.0.150.0060.00317.07
8.0.140.0000.00717.00
8.0.130.0000.00913.42
8.0.120.0040.00416.97
8.0.110.0000.00817.03
8.0.100.0040.00416.82
8.0.90.0000.00717.10
8.0.80.0060.00917.07
8.0.70.0000.00817.00
8.0.60.0040.00416.98
8.0.50.0000.00816.89
8.0.30.0130.01017.25
8.0.20.0050.01417.40
8.0.10.0000.00717.20
8.0.00.0090.00916.86
7.4.330.0020.00215.14
7.4.320.0050.00216.65
7.4.300.0000.00616.56
7.4.290.0000.00716.66
7.4.280.0000.00716.64
7.4.270.0070.00016.80
7.4.260.0000.00716.70
7.4.250.0030.00516.71
7.4.240.0060.00216.73
7.4.230.0000.00816.55
7.4.220.0140.00616.66
7.4.210.0090.00816.73
7.4.200.0030.00316.75
7.4.190.0030.00316.82
7.4.160.0060.01316.62
7.4.150.0100.00717.40
7.4.140.0120.00617.86
7.4.130.0130.00716.67
7.4.120.0110.00716.58
7.4.110.0030.01316.83
7.4.100.0030.02116.61
7.4.90.0110.00716.75
7.4.80.0060.01219.39
7.4.70.0120.00616.65
7.4.60.0070.01116.86
7.4.50.0040.00416.70
7.4.40.0120.00622.77
7.4.30.0040.01216.49
7.4.00.0060.00915.33
7.3.330.0030.00313.30
7.3.320.0030.00313.37
7.3.310.0030.00316.23
7.3.300.0030.00316.25
7.3.290.0060.01016.38
7.3.280.0050.01416.37
7.3.270.0170.01017.40
7.3.260.0130.01316.62
7.3.250.0090.00916.42
7.3.240.0080.01116.65
7.3.230.0110.01116.46
7.3.210.0100.00716.52
7.3.200.0060.01119.39
7.3.190.0110.01216.50
7.3.180.0170.00016.58
7.3.170.0110.00716.53
7.3.160.0080.00816.62
7.3.120.0030.01214.78
7.2.330.0110.01116.93
7.2.320.0050.01116.75
7.2.310.0070.01416.94
7.2.300.0100.00716.93
7.2.290.0060.01016.66
7.2.00.0060.00919.49
7.1.200.0070.00715.93
7.1.100.0040.01218.35
7.1.70.0000.00917.45
7.1.60.0120.01219.82
7.1.50.0090.01317.05
7.1.00.0030.09722.48
7.0.200.0070.00517.07
7.0.140.0070.07322.15
7.0.80.0500.07319.90
7.0.70.0430.06020.00
7.0.60.0470.06019.96
7.0.50.0370.08020.21
7.0.40.0130.07320.18
7.0.30.0030.05320.03
7.0.20.0070.06320.10
7.0.10.0130.08020.12
7.0.00.0100.09020.09
5.6.230.0070.04020.65
5.6.220.0100.06320.63
5.6.210.0170.07020.60
5.6.200.0030.08721.13
5.6.190.0100.07720.95
5.6.180.0100.07721.05
5.6.170.0070.08021.19
5.6.160.0100.08021.13
5.6.150.0200.07021.04
5.6.140.0030.06320.95
5.6.130.0100.08320.95
5.6.120.0070.05321.10
5.6.110.0100.07721.11
5.6.100.0100.08720.96
5.6.90.0030.04721.05
5.6.80.0100.07320.53
5.6.70.0100.07720.34
5.6.60.0030.05720.55
5.6.50.0100.07720.48
5.6.40.0130.07720.42
5.6.30.0100.08020.44
5.6.20.0030.07720.54
5.6.10.0170.07020.39
5.6.00.0070.07720.41
5.5.370.0070.06020.38
5.5.360.0100.08320.55
5.5.350.0000.05720.36
5.5.340.0100.07720.91
5.5.330.0030.07320.94
5.5.320.0100.07720.83
5.5.310.0170.05320.82
5.5.300.0070.08720.82
5.5.290.0170.07720.94
5.5.280.0070.08320.84
5.5.270.0100.06020.91
5.5.260.0030.08320.84
5.5.250.0100.06020.70
5.5.240.0070.04720.33
5.5.230.0030.08720.23
5.5.220.0070.07020.32
5.5.210.0130.07020.13
5.5.200.0130.08020.21
5.5.190.0070.08720.24
5.5.180.0030.08020.14
5.5.160.0170.06720.29
5.5.150.0070.08020.17
5.5.140.0130.07320.17
5.5.130.0130.07020.25
5.5.120.0170.05020.29
5.5.110.0070.06020.27
5.5.100.0030.05020.00
5.5.90.0030.08720.11
5.5.80.0000.06720.12
5.5.70.0130.07320.07
5.5.60.0070.07720.13
5.5.50.0070.07320.16
5.5.40.0130.05720.10
5.5.30.0070.08720.13
5.5.20.0030.08019.98
5.5.10.0130.06720.02
5.5.00.0130.07320.05
5.4.450.0130.07719.46
5.4.440.0170.06019.45
5.4.430.0030.04319.45
5.4.420.0030.08019.53
5.4.410.0100.04319.23
5.4.400.0170.04718.95
5.4.390.0100.07718.87
5.4.380.0030.05319.03
5.4.370.0130.06718.87
5.4.360.0070.04319.03
5.4.350.0070.05319.14
5.4.340.0270.06319.25
5.4.320.0130.06018.96
5.4.310.0200.07018.88
5.4.300.0000.08719.04
5.4.290.0130.07319.13
5.4.280.0170.07019.04
5.4.270.0130.04718.88
5.4.260.0170.06018.95
5.4.250.0170.06319.13
5.4.240.0100.04019.23
5.4.230.0070.08019.17
5.4.220.0070.08019.02
5.4.210.0100.07319.14
5.4.200.0070.07318.94
5.4.190.0130.04719.16
5.4.180.0000.08319.11
5.4.170.0070.08018.84
5.4.160.0100.06019.07
5.4.150.0100.07319.10
5.4.140.0130.06316.48
5.4.130.0100.03316.48
5.4.120.0030.03716.27
5.4.110.0070.07016.49
5.4.100.0030.04316.50
5.4.90.0100.06716.39
5.4.80.0070.07316.46
5.4.70.0070.03316.32
5.4.60.0030.04016.46
5.4.50.0130.06716.32
5.4.40.0070.03716.49
5.4.30.0070.04716.33
5.4.20.0030.04316.25
5.4.10.0000.04716.45
5.4.00.0030.04315.94
5.3.290.0030.05314.70
5.3.280.0030.07014.68
5.3.270.0030.04314.74
5.3.260.0030.08314.61
5.3.250.0000.05014.57
5.3.240.0170.03314.65
5.3.230.0030.06314.71
5.3.220.0000.05014.71
5.3.210.0070.08014.58
5.3.200.0100.07014.68
5.3.190.0000.04314.63
5.3.180.0130.07014.61
5.3.170.0030.07014.51
5.3.160.0030.04014.52
5.3.150.0170.06314.71
5.3.140.0100.05314.68
5.3.130.0030.03714.59
5.3.120.0100.05014.57
5.3.110.0030.06714.67
5.3.100.0030.08014.02
5.3.90.0030.06014.05
5.3.80.0070.04314.09
5.3.70.0070.07314.07
5.3.60.0030.05714.01
5.3.50.0170.06313.94
5.3.40.0070.06714.01
5.3.30.0070.03314.02
5.3.20.0100.04313.80
5.3.10.0070.07013.70
5.3.00.0070.05713.72
5.2.170.0070.05711.53
5.2.160.0070.05311.53
5.2.150.0000.04311.53
5.2.140.0100.05011.53
5.2.130.0030.06711.53
5.2.120.0030.04311.53
5.2.110.0030.06011.53
5.2.100.0100.04011.53
5.2.90.0000.05011.53
5.2.80.0070.03711.53
5.2.70.0030.03011.53
5.2.60.0030.06711.53
5.2.50.0100.05311.53
5.2.40.0000.06711.53
5.2.30.0000.04711.53
5.2.20.0130.05311.53
5.2.10.0070.06011.53
5.2.00.0100.05011.53
5.1.60.0030.03711.53
5.1.50.0030.06011.53
5.1.40.0070.05011.53
5.1.30.0030.05711.53
5.1.20.0070.04711.53
5.1.10.0030.04711.53
5.1.00.0100.02311.53
5.0.50.0070.04311.53
5.0.40.0070.04311.53
5.0.30.0070.06011.53
5.0.20.0070.04711.53
5.0.10.0000.04311.53
5.0.00.0030.06711.53
4.4.90.0070.01311.53
4.4.80.0030.02711.53
4.4.70.0030.02311.53
4.4.60.0000.03711.53
4.4.50.0000.03011.53
4.4.40.0000.04011.53
4.4.30.0030.03711.53
4.4.20.0000.03311.53
4.4.10.0000.04311.53
4.4.00.0000.06011.53
4.3.110.0000.03711.53
4.3.100.0000.02711.53
4.3.90.0030.02711.53
4.3.80.0000.05711.53
4.3.70.0070.02311.53
4.3.60.0030.03011.53
4.3.50.0030.03311.53
4.3.40.0030.04311.53
4.3.30.0000.02711.53
4.3.20.0000.02711.53
4.3.10.0030.03311.53
4.3.00.0000.03011.53

preferences:
40.62 ms | 401 KiB | 5 Q