3v4l.org

run code in 300+ PHP versions simultaneously
<?php namespace Zend\Stdlib { use DateTimeZone; class DateTime extends \DateTime { public function __construct($time = 'now', \DateTimeZone $timezone = null) { // workaround not required for PHP 5.3.7 or newer if(version_compare(PHP_VERSION, '5.3.7','>=')){ if($timezone) { return parent::__construct($time, $timezone); } else { return parent::__construct($time); } } // Check if using relative constructs if(!stristr($time, 'last') && !stristr($time, 'first')){ if($timezone) { return parent::__construct($time, $timezone); } else { return parent::__construct($time); } } // Use current time with constructor to prevent setting 'first_last_day_of' flag if($timezone) { parent::__construct('now', $timezone); } else { parent::__construct('now'); } // 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.0110.00416.88
8.3.50.0140.00422.08
8.3.40.0110.00718.92
8.3.30.0100.00319.08
8.3.20.0000.00720.21
8.3.10.0050.00323.52
8.3.00.0080.00019.50
8.2.180.0110.00716.75
8.2.170.0070.00722.96
8.2.160.0100.00320.19
8.2.150.0080.00024.18
8.2.140.0080.00024.66
8.2.130.0150.00326.16
8.2.120.0050.00322.20
8.2.110.0030.00622.14
8.2.100.0120.00017.84
8.2.90.0030.00619.21
8.2.80.0030.00618.16
8.2.70.0060.00317.63
8.2.60.0030.00617.68
8.2.50.0050.00318.07
8.2.40.0040.00418.34
8.2.30.0040.00418.04
8.2.20.0060.00317.69
8.2.10.0050.00319.98
8.2.00.0030.00617.70
8.1.280.0070.01425.92
8.1.270.0100.00621.89
8.1.260.0040.00426.35
8.1.250.0040.00428.09
8.1.240.0030.00623.91
8.1.230.0070.00419.19
8.1.220.0040.00417.75
8.1.210.0030.00518.77
8.1.200.0090.00017.38
8.1.190.0000.00817.40
8.1.180.0050.00318.10
8.1.170.0030.00618.74
8.1.160.0070.00022.05
8.1.150.0040.00418.81
8.1.140.0060.00317.64
8.1.130.0070.00017.80
8.1.120.0000.00717.67
8.1.110.0040.00417.62
8.1.100.0040.00417.52
8.1.90.0050.00317.74
8.1.80.0000.00817.65
8.1.70.0050.00317.61
8.1.60.0030.00617.72
8.1.50.0040.00417.64
8.1.40.0000.00817.63
8.1.30.0000.00817.73
8.1.20.0040.00417.62
8.1.10.0000.00717.60
8.1.00.0040.00417.63
8.0.300.0050.00318.77
8.0.290.0070.00017.05
8.0.280.0040.00418.48
8.0.270.0070.00017.33
8.0.260.0000.00716.95
8.0.250.0040.00416.98
8.0.240.0050.00317.00
8.0.230.0070.00017.06
8.0.220.0030.00316.94
8.0.210.0000.00716.92
8.0.200.0000.00617.09
8.0.190.0050.00516.96
8.0.180.0050.00317.00
8.0.170.0080.00017.02
8.0.160.0030.00517.01
8.0.150.0000.00716.91
8.0.140.0040.00416.88
8.0.130.0030.00313.42
8.0.120.0030.00516.97
8.0.110.0000.00717.03
8.0.100.0040.00416.97
8.0.90.0080.00016.83
8.0.80.0100.00716.99
8.0.70.0080.00016.83
8.0.60.0000.00816.81
8.0.50.0040.00416.90
8.0.30.0080.01017.27
8.0.20.0170.00517.44
8.0.10.0080.00017.01
8.0.00.0140.00416.96
7.4.330.0000.00515.27
7.4.320.0060.00016.78
7.4.300.0090.00016.57
7.4.290.0040.00416.79
7.4.280.0030.00316.74
7.4.270.0000.00716.64
7.4.260.0030.00716.72
7.4.250.0030.00616.47
7.4.240.0030.00516.59
7.4.230.0000.00716.83
7.4.220.0150.00616.59
7.4.210.0060.00916.80
7.4.200.0030.00316.85
7.4.190.0000.00716.53
7.4.160.0080.00816.81
7.4.150.0110.00717.40
7.4.140.0140.00717.86
7.4.130.0080.01216.69
7.4.120.0070.01216.54
7.4.110.0140.01016.68
7.4.100.0100.00716.50
7.4.90.0100.00716.61
7.4.80.0110.00819.39
7.4.70.0070.01416.53
7.4.60.0100.00716.78
7.4.50.0000.00516.66
7.4.40.0000.01422.77
7.4.30.0060.00916.59
7.4.00.0100.00715.05
7.3.330.0000.00513.30
7.3.320.0000.00513.19
7.3.310.0050.00216.48
7.3.300.0040.00416.25
7.3.290.0040.01116.38
7.3.280.0120.00416.33
7.3.270.0140.00317.40
7.3.260.0190.00016.63
7.3.250.0120.00816.49
7.3.240.0180.00016.63
7.3.230.0090.00916.39
7.3.210.0150.00316.24
7.3.200.0090.00919.39
7.3.190.0180.00016.57
7.3.180.0000.01716.30
7.3.170.0060.01116.38
7.3.160.0030.01316.39
7.3.120.0030.01414.81
7.3.10.0100.01116.25
7.3.00.0130.00616.38
7.2.330.0090.00916.89
7.2.320.0070.01116.86
7.2.310.0070.01016.86
7.2.300.0100.00716.75
7.2.290.0100.01316.70
7.2.130.0120.00816.54
7.2.120.0080.00816.89
7.2.110.0100.00816.75
7.2.100.0110.00516.87
7.2.90.0100.01016.63
7.2.80.0130.00916.72
7.2.70.0140.00616.70
7.2.60.0140.00916.58
7.2.50.0130.00916.68
7.2.40.0120.00916.46
7.2.30.0140.00716.47
7.2.20.0120.01216.48
7.2.10.0160.00916.78
7.2.00.0120.00716.81
7.1.250.0150.00515.61
7.1.70.0040.00417.38
7.1.60.0110.01419.33
7.1.50.0100.00717.04
7.1.00.0000.07722.48
7.0.200.0030.00716.91
7.0.140.0030.07322.12
7.0.100.0070.09020.07
7.0.90.0100.07319.95
7.0.80.0100.04319.92
7.0.70.0030.05719.95
7.0.60.0030.08319.99
7.0.50.0200.07020.25
7.0.40.0000.07020.07
7.0.30.0000.09320.07
7.0.20.0030.05020.17
7.0.10.0070.06719.99
7.0.00.0000.04720.05
5.6.280.0000.07321.10
5.6.250.0130.07720.59
5.6.240.0070.07720.66
5.6.230.0130.04320.62
5.6.220.0030.04020.64
5.6.210.0030.04720.49
5.6.200.0030.04321.07
5.6.190.0030.05320.98
5.6.180.0100.03720.98
5.6.170.0030.05720.95
5.6.160.0030.04020.91
5.6.150.0070.04021.18
5.6.140.0070.03721.03
5.6.130.0000.06321.03
5.6.120.0030.08721.18
5.6.110.0070.04021.04
5.6.100.0030.07021.05
5.6.90.0030.04320.90
5.6.80.0070.06320.54
5.6.70.0100.07320.44
5.6.60.0000.04720.43
5.6.50.0030.04020.46
5.6.40.0070.05720.46
5.6.30.0030.05320.41
5.6.20.0130.07320.51
5.6.10.0070.08020.41
5.6.00.0030.08020.38
5.5.380.0030.05020.57
5.5.370.0030.04320.52
5.5.360.0100.03320.36
5.5.350.0070.03720.36
5.5.340.0030.04020.89
5.5.330.0170.06720.78
5.5.320.0030.04320.78
5.5.310.0000.04720.91
5.5.300.0000.05020.94
5.5.290.0000.04720.66
5.5.280.0070.05320.90
5.5.270.0030.04320.93
5.5.260.0070.04020.79
5.5.250.0070.04020.56
5.5.240.0030.04020.32
5.5.230.0100.03720.18
5.5.220.0030.04020.25
5.5.210.0070.03720.27
5.5.200.0030.04020.18
5.5.190.0100.03320.17
5.5.180.0070.07020.20
5.5.160.0130.07320.10
5.5.150.0130.06720.20
5.5.140.0070.07320.27
5.5.130.0070.07320.08
5.5.120.0030.07720.13
5.5.110.0030.08720.24
5.5.100.0130.07320.09
5.5.90.0000.08320.09
5.5.80.0070.05720.18
5.5.70.0030.05020.14
5.5.60.0030.05720.17
5.5.50.0030.07320.16
5.5.40.0130.07020.02
5.5.30.0070.08020.13
5.5.20.0130.03320.13
5.5.10.0070.07020.02
5.5.00.0100.06020.07
5.4.450.0000.04319.22
5.4.440.0000.04719.20
5.4.430.0070.03719.36
5.4.420.0070.05319.44
5.4.410.0030.03719.41
5.4.400.0070.03319.04
5.4.390.0070.03719.19
5.4.380.0130.02719.22
5.4.370.0030.04319.13
5.4.360.0030.06719.04
5.4.350.0030.03719.10
5.4.340.0030.04019.13
5.4.320.0100.07318.89
5.4.310.0030.07319.18
5.4.300.0100.03719.21
5.4.290.0170.03319.18
5.4.280.0000.04719.09
5.4.270.0070.05719.04
5.4.260.0000.07318.98
5.4.250.0100.06719.21
5.4.240.0070.07719.02
5.4.230.0100.07718.86
5.4.220.0100.06719.12
5.4.210.0170.05319.02
5.4.200.0170.06719.12
5.4.190.0100.04018.93
5.4.180.0030.07719.02
5.4.170.0100.07019.11
5.4.160.0070.07319.03
5.4.150.0070.07719.04
5.4.140.0130.06316.39
5.4.130.0130.05316.45
5.4.120.0000.04716.38
5.4.110.0030.08016.57
5.4.100.0030.07016.39
5.4.90.0070.05016.52
5.4.80.0100.06716.41
5.4.70.0030.04716.31
5.4.60.0100.06716.30
5.4.50.0130.07316.31
5.4.40.0130.05716.38
5.4.30.0100.06716.32
5.4.20.0170.03316.49
5.4.10.0070.07316.32
5.4.00.0030.07715.88
5.3.290.0130.07014.63
5.3.280.0100.07314.65
5.3.270.0030.07314.66
5.3.260.0070.08014.60
5.3.250.0030.05014.57
5.3.240.0070.06014.61
5.3.230.0130.04714.57
5.3.220.0100.07014.55
5.3.210.0070.06714.60
5.3.200.0030.07014.65
5.3.190.0070.07714.71
5.3.180.0030.07714.52
5.3.170.0130.07314.64
5.3.160.0130.06714.70
5.3.150.0100.03714.66
5.3.140.0100.06714.61
5.3.130.0070.04314.63
5.3.120.0100.03314.71
5.3.110.0100.04714.70
5.3.100.0170.06714.20
5.3.90.0100.05714.15
5.3.80.0130.06714.13
5.3.70.0000.05014.13
5.3.60.0030.06314.09
5.3.50.0030.06713.88
5.3.40.0000.08014.06
5.3.30.0070.07014.03
5.3.20.0100.06013.63
5.3.10.0030.07013.70
5.3.00.0030.06713.72
5.2.170.0130.04310.94
5.2.160.0070.05711.18
5.2.150.0100.06011.00
5.2.140.0100.06011.06
5.2.130.0000.06710.92
5.2.120.0100.05711.02
5.2.110.0070.06011.13
5.2.100.0070.06010.95
5.2.90.0070.06011.05
5.2.80.0070.05011.09
5.2.70.0030.05311.16
5.2.60.0100.03311.02
5.2.50.0030.04711.02
5.2.40.0070.06310.92
5.2.30.0070.06010.89
5.2.20.0070.06310.81
5.2.10.0100.05710.93
5.2.00.0070.05010.64
5.1.60.0100.03710.01
5.1.50.0030.05310.01
5.1.40.0030.04710.01
5.1.30.0100.03710.29
5.1.20.0030.04010.27
5.1.10.0000.06010.13
5.1.00.0100.04010.12
5.0.50.0030.04710.01
5.0.40.0070.04010.01
5.0.30.0030.06710.01
5.0.20.0070.03710.01
5.0.10.0030.04310.01
5.0.00.0070.06310.01
4.4.90.0000.03310.01
4.4.80.0030.03310.01
4.4.70.0000.03710.01
4.4.60.0000.03310.01
4.4.50.0070.01710.01
4.4.40.0000.05310.01
4.4.30.0030.03710.01
4.4.20.0000.02310.01
4.4.10.0030.03710.01
4.4.00.0000.03710.01
4.3.110.0030.03710.01
4.3.100.0030.03310.01
4.3.90.0070.03010.01
4.3.80.0100.04010.01
4.3.70.0000.03710.01
4.3.60.0000.03710.01
4.3.50.0000.03310.01
4.3.40.0030.05310.01
4.3.30.0030.03310.01
4.3.20.0000.03710.01
4.3.10.0030.03310.01
4.3.00.0000.02710.01

preferences:
45.55 ms | 401 KiB | 5 Q