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 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.40.0160.00619.02
8.3.30.0040.01119.04
8.3.20.0040.00420.33
8.3.10.0000.00823.48
8.3.00.0040.00419.02
8.2.170.0110.00422.96
8.2.160.0100.00320.43
8.2.150.0040.00424.18
8.2.140.0040.00424.66
8.2.130.0070.00026.16
8.2.120.0000.00820.79
8.2.110.0090.00022.30
8.2.100.0090.00319.76
8.2.90.0000.00819.19
8.2.80.0040.00417.97
8.2.70.0080.00017.75
8.2.60.0070.00417.93
8.2.50.0030.00618.07
8.2.40.0000.00821.14
8.2.30.0040.00418.43
8.2.20.0050.00317.79
8.2.10.0000.00718.13
8.2.00.0060.00317.72
8.1.270.0040.00423.89
8.1.260.0090.00026.35
8.1.250.0080.00028.09
8.1.240.0090.00023.88
8.1.230.0040.00719.15
8.1.220.0000.00917.76
8.1.210.0040.00418.77
8.1.200.0030.00617.48
8.1.190.0030.00617.35
8.1.180.0050.00318.10
8.1.170.0040.00418.71
8.1.160.0050.00222.07
8.1.150.0060.00318.82
8.1.140.0040.00417.63
8.1.130.0070.00017.89
8.1.120.0040.00417.55
8.1.110.0030.00517.51
8.1.100.0040.00417.61
8.1.90.0050.00317.60
8.1.80.0050.00317.54
8.1.70.0040.00417.52
8.1.60.0040.00417.74
8.1.50.0000.00917.55
8.1.40.0040.00417.55
8.1.30.0060.00317.61
8.1.20.0000.00817.81
8.1.10.0080.00017.57
8.1.00.0040.00417.65
8.0.300.0000.00718.77
8.0.290.0000.00717.18
8.0.280.0000.00718.48
8.0.270.0000.00717.42
8.0.260.0030.00317.41
8.0.250.0030.00317.01
8.0.240.0080.00017.11
8.0.230.0000.00716.99
8.0.220.0040.00417.04
8.0.210.0030.00317.06
8.0.200.0070.00017.10
8.0.190.0000.00816.98
8.0.180.0070.00016.94
8.0.170.0000.00716.93
8.0.160.0070.00017.16
8.0.150.0040.00416.88
8.0.140.0020.00516.99
8.0.130.0070.00013.38
8.0.120.0040.00416.99
8.0.110.0070.00016.89
8.0.100.0000.00716.93
8.0.90.0040.00416.84
8.0.80.0040.01217.00
8.0.70.0030.00516.89
8.0.60.0000.00716.87
8.0.50.0050.00316.89
8.0.30.0110.00717.26
8.0.20.0150.00817.40
8.0.10.0040.00417.20
8.0.00.0130.00516.90
7.4.330.0030.00315.00
7.4.320.0060.00016.73
7.4.300.0050.00216.71
7.4.290.0000.00716.71
7.4.280.0000.00816.65
7.4.270.0070.00016.72
7.4.260.0070.00016.63
7.4.250.0050.00316.61
7.4.240.0050.00216.72
7.4.230.0050.00316.62
7.4.220.0110.00716.71
7.4.210.0050.01016.79
7.4.200.0000.00716.78
7.4.190.0080.00016.68
7.4.160.0160.00016.80
7.4.150.0130.00517.40
7.4.140.0100.01217.86
7.4.130.0120.00516.61
7.4.120.0070.01016.62
7.4.110.0150.00316.59
7.4.100.0130.01016.56
7.4.90.0140.01016.73
7.4.80.0130.00619.39
7.4.70.0130.01016.74
7.4.60.0120.01216.67
7.4.50.0000.00816.46
7.4.40.0110.00516.56
7.4.30.0060.01216.74
7.4.10.0070.00715.30
7.4.00.0110.00515.05
7.3.330.0020.00313.45
7.3.320.0050.00013.37
7.3.310.0040.00416.33
7.3.300.0000.00716.30
7.3.290.0150.00416.38
7.3.280.0100.01016.44
7.3.270.0110.00717.40
7.3.260.0120.00616.50
7.3.250.0090.00916.53
7.3.240.0100.01016.51
7.3.230.0070.01316.52
7.3.210.0090.00916.39
7.3.200.0060.01219.39
7.3.190.0060.01116.61
7.3.180.0070.01016.32
7.3.170.0040.01816.60
7.3.160.0000.01716.60
7.3.130.0100.01015.14
7.3.120.0050.01114.93
7.3.110.0130.00614.69
7.3.100.0030.01114.94
7.3.90.0070.00714.98
7.3.80.0080.00414.96
7.3.70.0060.00614.96
7.3.60.0060.00614.98
7.3.50.0080.00314.77
7.3.40.0040.00814.89
7.3.30.0090.00615.08
7.3.20.0080.00816.82
7.3.10.0100.00616.51
7.3.00.0120.00316.77
7.2.330.0100.00916.92
7.2.320.0130.00416.79
7.2.310.0090.00916.86
7.2.300.0110.00716.87
7.2.290.0090.00916.75
7.2.260.0070.01115.34
7.2.250.0110.00715.17
7.2.240.0100.00715.05
7.2.230.0100.00315.22
7.2.220.0070.00715.02
7.2.210.0000.01115.13
7.2.200.0070.01015.04
7.2.190.0060.00614.98
7.2.180.0030.01215.20
7.2.170.0040.01115.08
7.2.160.0110.00014.99
7.2.150.0090.00616.66
7.2.140.0030.01317.00
7.2.130.0080.01016.69
7.2.120.0110.00816.76
7.2.110.0090.00816.62
7.2.100.0060.01116.75
7.2.90.0100.00716.97
7.2.80.0080.01016.94
7.2.70.0040.00916.72
7.2.60.0050.01016.98
7.2.50.0120.00516.81
7.2.40.0070.01016.94
7.2.30.0070.00816.86
7.2.20.0050.01016.84
7.2.10.0030.00916.98
7.2.00.0070.01016.95
7.1.330.0080.00616.14
7.1.320.0060.01216.02
7.1.310.0060.00915.70
7.1.300.0070.00715.84
7.1.290.0040.01115.93
7.1.280.0060.00315.71
7.1.270.0050.00515.66
7.1.260.0030.00615.79
7.1.250.0060.01115.81
7.1.240.0030.00716.07
7.1.230.0090.00915.86
7.1.220.0040.00716.02
7.1.210.0090.00615.97
7.1.200.0080.00615.94
7.1.190.0030.00615.93
7.1.180.0030.00615.61
7.1.170.0070.00315.59
7.1.160.0060.00915.96
7.1.150.0000.01215.95
7.1.140.0040.01115.95
7.1.130.0000.00815.92
7.1.120.0040.01115.92
7.1.110.0030.01216.01
7.1.100.0040.00816.09
7.1.90.0060.00315.70
7.1.80.0080.00516.07
7.1.70.0040.00616.55
7.1.60.0090.01017.73
7.1.50.0060.00516.46
7.1.40.0110.00415.94
7.1.30.0090.00615.77
7.1.20.0090.00615.77
7.1.10.0100.00315.78
7.1.00.0070.04019.07
7.0.330.0070.00415.66
7.0.320.0080.00415.66
7.0.310.0030.00615.59
7.0.300.0040.01115.61
7.0.290.0100.00015.57
7.0.280.0070.00715.41
7.0.270.0080.00315.57
7.0.260.0000.01615.62
7.0.250.0030.00915.63
7.0.240.0100.00715.71
7.0.230.0030.00915.68
7.0.220.0080.00315.26
7.0.210.0040.00415.64
7.0.200.0030.00616.23
7.0.190.0040.00415.50
7.0.180.0110.00315.41
7.0.170.0090.00315.37
7.0.160.0000.00915.84
7.0.150.0030.00715.41
7.0.140.0050.03718.92
7.0.130.0090.00615.57
7.0.120.0030.00515.59
7.0.110.0000.01015.66
7.0.100.0030.01015.26
7.0.90.0060.00615.40
7.0.80.0080.02317.74
7.0.70.0120.03517.74
7.0.60.0100.04117.71
7.0.50.0350.04518.01
7.0.40.0020.04916.81
7.0.30.0080.04516.85
7.0.20.0100.04816.94
7.0.10.0020.04016.82
7.0.00.0070.04516.90
5.6.400.0000.01514.88
5.6.390.0000.01414.48
5.6.380.0000.01014.48
5.6.370.0040.00414.67
5.6.360.0000.01214.29
5.6.350.0060.00314.63
5.6.340.0000.01614.53
5.6.330.0130.00314.45
5.6.320.0080.00314.64
5.6.310.0000.00914.27
5.6.300.0090.00014.54
5.6.290.0000.00814.33
5.6.280.0050.03817.86
5.6.270.0040.01114.54
5.6.260.0040.00414.55
5.6.250.0000.01114.54
5.6.240.0080.00014.57
5.6.230.0050.03217.57
5.6.220.0070.04217.46
5.6.210.0030.04717.46
5.6.200.0050.04117.80
5.6.190.0120.03917.74
5.6.180.0100.03517.91
5.6.170.0050.05117.78
5.6.160.0150.02317.67
5.6.150.0130.03617.87
5.6.140.0190.02117.72
5.6.130.0020.03317.73
5.6.120.0080.04517.66
5.6.110.0100.03117.76
5.6.100.0050.04417.69
5.6.90.0030.03417.63
5.6.80.0030.04417.38
5.6.70.0050.04517.52
5.6.60.0020.04217.36
5.6.50.0050.02517.48
5.6.40.0100.02317.54
5.6.30.0150.01817.53
5.6.20.0100.03717.32
5.6.10.0150.03217.33
5.6.00.0070.04317.36
5.5.380.0060.00314.41
5.5.370.0060.04517.29
5.5.360.0020.04817.41
5.5.350.0040.04717.24
5.5.340.0030.04517.70
5.5.330.0020.02817.75
5.5.320.0060.04317.62
5.5.310.0060.04517.77
5.5.300.0100.04317.52
5.5.290.0060.04717.74
5.5.280.0050.04617.68
5.5.270.0050.04917.46
5.5.260.0080.03817.71
5.5.250.0100.04217.65
5.5.240.0070.02917.28
5.5.230.0030.03417.33
5.5.220.0080.03017.10
5.5.210.0180.03317.26
5.5.200.0030.02717.37
5.5.190.0070.04417.40
5.5.180.0050.02517.34
5.5.170.0060.00314.26
5.5.160.0060.02817.28
5.5.150.0050.04117.27
5.5.140.0120.01717.17
5.5.130.0050.03317.24
5.5.120.0100.04217.40
5.5.110.0040.02917.29
5.5.100.0050.03917.21
5.5.90.0050.02217.14
5.5.80.0070.02217.15
5.5.70.0050.04217.24
5.5.60.0050.03317.30
5.5.50.0090.02117.15
5.5.40.0080.03517.24
5.5.30.0050.02617.07
5.5.20.0080.02817.24
5.5.10.0100.04017.15
5.5.00.0080.02417.15
5.4.450.0040.03215.54
5.4.440.0050.04315.62
5.4.430.0070.04515.48
5.4.420.0050.02815.54
5.4.410.0160.03015.49
5.4.400.0050.04415.34
5.4.390.0070.03015.30
5.4.380.0060.04115.38
5.4.370.0050.02415.40
5.4.360.0070.03715.29
5.4.350.0050.03715.30
5.4.340.0070.04015.39
5.4.330.0000.00611.73
5.4.320.0070.03715.43
5.4.310.0080.03515.43
5.4.300.0080.04115.42
5.4.290.0130.03315.43
5.4.280.0040.04415.45
5.4.270.0070.02215.44
5.4.260.0020.02515.41
5.4.250.0020.04215.44
5.4.240.0070.03015.39
5.4.230.0030.02915.31
5.4.220.0070.03415.44
5.4.210.0080.04015.39
5.4.200.0120.03415.38
5.4.190.0070.03815.38
5.4.180.0050.04015.42
5.4.170.0020.04215.48
5.4.160.0050.03015.46
5.4.150.0060.04015.46
5.4.140.0050.03914.11
5.4.130.0050.03014.10
5.4.120.0030.02214.12
5.4.110.0070.03914.06
5.4.100.0040.03114.09
5.4.90.0030.02314.09
5.4.80.0050.04014.10
5.4.70.0120.03414.08
5.4.60.0050.04114.08
5.4.50.0000.03214.06
5.4.40.0050.02314.07
5.4.30.0100.02314.09
5.4.20.0020.04414.06
5.4.10.0030.02714.07
5.4.00.0080.03713.75
5.3.290.0050.02713.18
5.3.280.0070.02313.19
5.3.270.0050.02413.19
5.3.260.0100.03213.21
5.3.250.0050.03813.17
5.3.240.0030.02813.19
5.3.230.0070.03213.25
5.3.220.0030.03613.19
5.3.210.0050.03013.17
5.3.200.0030.04013.19
5.3.190.0050.02513.13
5.3.180.0030.02713.21
5.3.170.0050.04113.13
5.3.160.0090.02613.20
5.3.150.0050.04113.19
5.3.140.0050.02313.21
5.3.130.0020.04813.15
5.3.120.0050.04113.21
5.3.110.0030.02713.15
5.3.100.0100.01712.88
5.3.90.0050.04112.93
5.3.80.0080.04012.88
5.3.70.0060.04312.90
5.3.60.0070.03712.88
5.3.50.0030.02612.89
5.3.40.0060.02212.92
5.3.30.0050.03012.89
5.3.20.0050.02912.67
5.3.10.0080.01712.75
5.3.00.0100.03012.64
5.2.170.0100.06011.76
5.2.160.0070.04711.76
5.2.150.0070.06311.76
5.2.140.0070.04011.76
5.2.130.0030.03011.76
5.2.120.0030.02711.76
5.2.110.0030.06311.76
5.2.100.0000.03011.76
5.2.90.0000.03011.76
5.2.80.0070.05711.76
5.2.70.0030.03711.76
5.2.60.0000.03011.76
5.2.50.0070.05311.76
5.2.40.0030.05711.76
5.2.30.0070.05011.76
5.2.20.0100.05711.76
5.2.10.0000.03011.76
5.2.00.0030.06011.76
5.1.60.0030.05311.76
5.1.50.0030.04011.76
5.1.40.0000.05711.76
5.1.30.0070.04011.76
5.1.20.0000.04011.76
5.1.10.0000.04311.76
5.1.00.0070.03711.76
5.0.50.0000.02311.76
5.0.40.0030.03711.76
5.0.30.0070.04311.76
5.0.20.0070.04011.76
5.0.10.0100.02011.76
5.0.00.0000.03011.76
4.4.90.0000.01711.76
4.4.80.0030.03011.76
4.4.70.0030.04011.76
4.4.60.0000.02311.76
4.4.50.0000.02011.76
4.4.40.0000.05311.76
4.4.30.0030.02311.76
4.4.20.0070.02311.76
4.4.10.0000.01711.76
4.4.00.0000.02311.76
4.3.110.0000.03011.76
4.3.100.0000.01711.76
4.3.90.0000.02311.76
4.3.80.0000.02311.76
4.3.70.0030.01311.76
4.3.60.0000.01711.76
4.3.50.0000.02011.76
4.3.40.0000.02311.76
4.3.30.0000.01711.76
4.3.20.0030.01711.76
4.3.10.0000.01711.76
4.3.00.0000.01711.76

preferences:
37.94 ms | 400 KiB | 5 Q