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'); $dt = new DateTime('2011-01-01'); $dt->modify('last day of january'); 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.01118.80
8.3.50.0110.00522.05
8.3.40.0040.01419.00
8.3.30.0070.00719.08
8.3.20.0040.00420.35
8.3.10.0080.00023.58
8.3.00.0060.00322.45
8.2.180.0120.00317.13
8.2.170.0070.01122.96
8.2.160.0090.00622.26
8.2.150.0050.00324.18
8.2.140.0060.00924.66
8.2.130.0040.00426.16
8.2.120.0000.00819.50
8.2.110.0030.00619.39
8.2.100.0040.00817.86
8.2.90.0040.00419.25
8.2.80.0000.00817.97
8.2.70.0000.00917.75
8.2.60.0080.00018.16
8.2.50.0040.00418.07
8.2.40.0000.00818.22
8.2.30.0050.00318.04
8.2.20.0000.00717.76
8.2.10.0040.00419.77
8.2.00.0040.00417.78
8.1.280.0090.00625.92
8.1.270.0040.00423.93
8.1.260.0040.00426.35
8.1.250.0110.00428.09
8.1.240.0030.00622.14
8.1.230.0080.00319.00
8.1.220.0080.00017.74
8.1.210.0040.00418.77
8.1.200.0040.00417.47
8.1.190.0080.00317.35
8.1.180.0040.00418.10
8.1.170.0060.00318.59
8.1.160.0040.00421.89
8.1.150.0060.00318.75
8.1.140.0040.00417.63
8.1.130.0050.00217.93
8.1.120.0040.00417.57
8.1.110.0030.00617.62
8.1.100.0040.00417.62
8.1.90.0040.00417.66
8.1.80.0040.00417.58
8.1.70.0000.00717.56
8.1.60.0060.00317.68
8.1.50.0000.00817.70
8.1.40.0040.00417.70
8.1.30.0060.00317.73
8.1.20.0060.00317.71
8.1.10.0000.00817.64
8.1.00.0000.00817.61
8.0.300.0040.00420.10
8.0.290.0080.00316.88
8.0.280.0000.00718.48
8.0.270.0000.00717.35
8.0.260.0030.00317.02
8.0.250.0070.00017.13
8.0.240.0030.00317.21
8.0.230.0000.00717.18
8.0.220.0070.00017.04
8.0.210.0040.00416.98
8.0.200.0000.00617.16
8.0.190.0040.00417.09
8.0.180.0000.00717.12
8.0.170.0040.00416.95
8.0.160.0000.00717.13
8.0.150.0000.00717.10
8.0.140.0040.00416.98
8.0.130.0030.00313.41
8.0.120.0040.00417.11
8.0.110.0000.00817.05
8.0.100.0040.00417.20
8.0.90.0050.00217.02
8.0.80.0130.00316.98
8.0.70.0040.00416.97
8.0.60.0040.00416.96
8.0.50.0040.00416.99
8.0.30.0120.01017.19
8.0.20.0110.00817.40
8.0.10.0040.00417.11
8.0.00.0130.00816.95
7.4.330.0000.00515.08
7.4.320.0000.00616.76
7.4.300.0030.00316.54
7.4.290.0040.00416.66
7.4.280.0040.00416.48
7.4.270.0030.00316.64
7.4.260.0030.00316.68
7.4.250.0040.00416.71
7.4.240.0040.00416.71
7.4.230.0030.00316.71
7.4.220.0080.01116.80
7.4.210.0060.01016.63
7.4.200.0040.00416.84
7.4.190.0040.00416.80
7.4.160.0080.00816.54
7.4.150.0040.01517.40
7.4.140.0140.00917.86
7.4.130.0050.01416.67
7.4.120.0150.00316.69
7.4.110.0070.01116.82
7.4.100.0090.01516.73
7.4.90.0120.00616.63
7.4.80.0170.00716.82
7.4.70.0080.00816.74
7.4.60.0070.01016.56
7.4.50.0030.00616.46
7.4.40.0070.01022.77
7.4.30.0130.00416.57
7.4.00.0040.01415.10
7.3.330.0000.00513.18
7.3.320.0000.00613.33
7.3.310.0030.00316.39
7.3.300.0060.00016.24
7.3.290.0080.01216.37
7.3.280.0060.01116.35
7.3.270.0100.00717.40
7.3.260.0110.00816.55
7.3.250.0080.01016.46
7.3.240.0070.01016.48
7.3.230.0090.00916.48
7.3.210.0180.00016.34
7.3.200.0150.00619.39
7.3.190.0070.01116.39
7.3.180.0070.01016.30
7.3.170.0100.00716.36
7.3.160.0080.01116.41
7.3.120.0100.00714.98
7.3.10.0070.00316.66
7.3.00.0000.01416.54
7.2.330.0070.01116.72
7.2.320.0070.01016.86
7.2.310.0060.01116.67
7.2.300.0050.01116.59
7.2.290.0130.00616.87
7.2.130.0080.00416.83
7.2.120.0100.00317.05
7.2.110.0000.01317.12
7.2.100.0060.00316.75
7.2.90.0090.00316.80
7.2.80.0040.00717.13
7.2.70.0000.01116.92
7.2.60.0070.00716.89
7.2.50.0030.01016.96
7.2.40.0100.00317.02
7.2.30.0070.00717.14
7.2.20.0060.00316.79
7.2.10.0040.00716.77
7.2.00.0050.01018.31
7.1.250.0000.01115.72
7.1.200.0030.00516.06
7.1.100.0080.00318.08
7.1.70.0000.01017.44
7.1.60.0330.01317.42
7.1.50.0040.00816.97
7.1.00.0030.07722.27
7.0.200.0000.00816.91
7.0.140.0000.07722.21
7.0.100.0130.08019.99
7.0.90.0300.06720.16
7.0.80.0100.08319.90
7.0.70.0030.04719.96
7.0.60.0070.04319.80
7.0.50.0100.07020.33
7.0.40.0100.05720.10
7.0.30.0000.04319.96
7.0.20.0070.06720.18
7.0.10.0030.06320.18
7.0.00.0130.07720.10
5.6.280.0070.07020.97
5.6.250.0000.08020.55
5.6.240.0000.04320.71
5.6.230.0000.05320.64
5.6.220.0070.08320.72
5.6.210.0000.08720.63
5.6.200.0100.07021.06
5.6.190.0200.06721.06
5.6.180.0030.08321.04
5.6.170.0130.07321.09
5.6.160.0100.07321.12
5.6.150.0130.08721.06
5.6.140.0000.05021.03
5.6.130.0100.08021.06
5.6.120.0100.05021.02
5.6.110.0070.05321.17
5.6.100.0100.06021.02
5.6.90.0030.08321.04
5.6.80.0070.06720.36
5.6.70.0000.04020.45
5.6.60.0100.03020.50
5.6.50.0000.05320.44
5.6.40.0030.04020.39
5.6.30.0100.07020.33
5.6.20.0000.06320.46
5.6.10.0170.06020.48
5.6.00.0100.07020.44
5.5.380.0070.08020.38
5.5.370.0070.06320.38
5.5.360.0030.06720.57
5.5.350.0070.08020.43
5.5.340.0030.04320.88
5.5.330.0130.06720.88
5.5.320.0000.04720.95
5.5.310.0000.04720.94
5.5.300.0170.04720.92
5.5.290.0070.06020.64
5.5.280.0000.04320.87
5.5.270.0070.04320.89
5.5.260.0000.04320.90
5.5.250.0030.04020.72
5.5.240.0130.03020.32
5.5.230.0100.07020.18
5.5.220.0170.06720.18
5.5.210.0070.03320.27
5.5.200.0030.08020.12
5.5.190.0030.06320.28
5.5.180.0030.08320.10
5.5.160.0070.03720.10
5.5.150.0070.04320.25
5.5.140.0130.03720.13
5.5.130.0030.05020.20
5.5.120.0000.06320.01
5.5.110.0070.05720.14
5.5.100.0130.05720.13
5.5.90.0030.04320.18
5.5.80.0000.05320.19
5.5.70.0170.06020.08
5.5.60.0100.07320.02
5.5.50.0100.08020.10
5.5.40.0030.07720.07
5.5.30.0170.06720.17
5.5.20.0070.04320.08
5.5.10.0130.08320.13
5.5.00.0130.03720.13
5.4.450.0070.04719.45
5.4.440.0100.07319.45
5.4.430.0030.09019.46
5.4.420.0030.08319.36
5.4.410.0100.07719.40
5.4.400.0000.08018.85
5.4.390.0030.09019.16
5.4.380.0000.04319.03
5.4.370.0030.07318.90
5.4.360.0030.04319.03
5.4.350.0030.08019.11
5.4.340.0070.03718.95
5.4.320.0030.07318.84
5.4.310.0070.03719.13
5.4.300.0130.04019.18
5.4.290.0000.05019.09
5.4.280.0030.05019.04
5.4.270.0170.05719.22
5.4.260.0070.04719.09
5.4.250.0200.04319.20
5.4.240.0070.07719.13
5.4.230.0070.04719.20
5.4.220.0100.04719.13
5.4.210.0030.06719.04
5.4.200.0000.04319.24
5.4.190.0070.04018.93
5.4.180.0030.08019.11
5.4.170.0100.06318.86
5.4.160.0070.04319.07
5.4.150.0070.07019.11
5.4.140.0070.07316.48
5.4.130.0070.07316.46
5.4.120.0030.05316.46
5.4.110.0070.03316.55
5.4.100.0030.05016.34
5.4.90.0070.03016.41
5.4.80.0100.03016.37
5.4.70.0070.05316.46
5.4.60.0170.06016.26
5.4.50.0070.07316.48
5.4.40.0070.07316.30
5.4.30.0000.03316.30
5.4.20.0030.07716.38
5.4.10.0000.04016.47
5.4.00.0000.03715.80
5.3.290.0100.07014.71
5.3.280.0000.05014.72
5.3.270.0100.03714.62
5.3.260.0030.05714.72
5.3.250.0030.04314.64
5.3.240.0000.07714.55
5.3.230.0030.03314.73
5.3.220.0070.03014.62
5.3.210.0030.06714.70
5.3.200.0030.03314.65
5.3.190.0000.05714.53
5.3.180.0030.03314.73
5.3.170.0030.06714.61
5.3.160.0070.07014.51
5.3.150.0100.07014.57
5.3.140.0100.02714.50
5.3.130.0030.08014.59
5.3.120.0030.05714.71
5.3.110.0000.07014.66
5.3.100.0070.03714.13
5.3.90.0000.03714.05
5.3.80.0070.03714.10
5.3.70.0030.04014.04
5.3.60.0000.04014.13
5.3.50.0030.03713.94
5.3.40.0030.04013.99
5.3.30.0100.04013.95
5.3.20.0070.03313.62
5.3.10.0000.03713.73
5.3.00.0030.03313.78
5.2.170.0000.03011.17
5.2.160.0000.03011.09
5.2.150.0070.02310.99
5.2.140.0070.04010.97
5.2.130.0070.03011.11
5.2.120.0100.03310.92
5.2.110.0030.03710.94
5.2.100.0000.03011.09
5.2.90.0070.03311.14
5.2.80.0000.03010.89
5.2.70.0000.03011.16
5.2.60.0000.03310.87
5.2.50.0070.02710.96
5.2.40.0030.02710.95
5.2.30.0030.03010.77
5.2.20.0030.02710.95
5.2.10.0000.03010.92
5.2.00.0030.02710.64
5.1.60.0030.02310.01
5.1.50.0030.0239.82
5.1.40.0000.02710.03
5.1.30.0030.02710.39
5.1.20.0030.02710.26
5.1.10.0000.02710.10
5.1.00.0030.02310.12
5.0.50.0000.0209.73
5.0.40.0000.0209.73
5.0.30.0000.0309.73
5.0.20.0030.0179.73
5.0.10.0000.0239.73
5.0.00.0030.0279.73
4.4.90.0030.0139.73
4.4.80.0000.0179.73
4.4.70.0030.0139.73
4.4.60.0000.0179.73
4.4.50.0000.0179.73
4.4.40.0000.0509.73
4.4.30.0030.0209.73
4.4.20.0000.0139.73
4.4.10.0000.0179.73
4.4.00.0000.0279.73
4.3.110.0000.0179.73
4.3.100.0000.0209.73
4.3.90.0000.0179.73
4.3.80.0000.0239.73
4.3.70.0000.0139.73
4.3.60.0000.0139.73
4.3.50.0070.0109.73
4.3.40.0030.0239.73
4.3.30.0000.0179.73
4.3.20.0030.0139.73
4.3.10.0030.0139.73
4.3.00.0030.0109.73

preferences:
40 ms | 401 KiB | 5 Q