3v4l.org

run code in 300+ PHP versions simultaneously
<?php /** * Class PeriodIterator * * @author Efimov Evgeniy <evgeniy.efimov@alpari.org> */ class PeriodIterator implements \Iterator { /** * Start date * * @var \DateTime */ private $startDate; /** * End date * * @var \DateTime */ private $endDate; /** * Iteration offset * * @var string */ private $offset; /** * Current iteration date * * @var \DateTime */ private $currentDate; /** * PeriodIterator constructor. * * @param \DateTime $startDate Start date * @param \DateTime $endDate End date * @param string $offset Offset for iteration */ public function __construct(\DateTime $startDate, \DateTime $endDate, $offset) { $this->startDate = $startDate; $this->endDate = $endDate; $this->offset = $offset; } /** {@inheritdoc} */ public function current() { return $this->currentDate; } /** {@inheritdoc} */ public function next() { $this->currentDate->modify($this->offset); } /** {@inheritdoc} */ public function key() { return $this->currentDate->getTimestamp(); } /** {@inheritdoc} */ public function valid() { return $this->currentDate->getTimestamp() <= $this->endDate->getTimestamp(); } /** {@inheritdoc} */ public function rewind() { $this->currentDate = clone $this->startDate; } } $workLoad = new PeriodIterator(new \DateTime('sunday last week'), new DateTime('last day of this month'), "1 day" ); $secondPeriod = $workLoad->current($workLoad); echo $secondPeriod->format('Y-m-d H:i:s');

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.0120.00318.57
8.3.50.0160.00522.17
8.3.40.0150.00019.09
8.3.30.0090.00618.95
8.3.20.0040.00420.33
8.3.10.0060.00320.77
8.3.00.0070.00320.27
8.2.180.0170.00317.00
8.2.170.0110.00722.96
8.2.160.0150.00022.19
8.2.150.0090.00024.18
8.2.140.0080.00024.66
8.2.130.0040.00421.00
8.2.120.0030.00526.35
8.2.110.0040.00820.61
8.2.100.0050.00518.05
8.2.90.0050.00319.21
8.2.80.0050.00318.00
8.2.70.0040.00417.88
8.2.60.0040.00418.05
8.2.50.0070.00318.09
8.2.40.0060.00320.52
8.2.30.0060.00319.49
8.2.20.0000.00818.05
8.2.10.0000.00718.30
8.2.00.0040.00418.36
8.1.280.0120.00925.92
8.1.270.0050.00322.36
8.1.260.0100.00028.09
8.1.250.0030.01028.09
8.1.240.0090.00022.73
8.1.230.0070.00317.83
8.1.220.0090.00017.74
8.1.210.0000.00818.77
8.1.200.0040.00417.60
8.1.190.0050.00317.61
8.1.180.0030.00518.10
8.1.170.0060.00618.59
8.1.160.0040.00420.84
8.1.150.0040.00418.94
8.1.140.0040.00419.63
8.1.130.0050.00217.93
8.1.120.0050.00217.68
8.1.110.0040.00417.81
8.1.100.0000.00717.77
8.1.90.0000.00717.80
8.1.80.0090.00017.66
8.1.70.0070.00017.78
8.1.60.0030.00517.74
8.1.50.0000.00817.69
8.1.40.0080.00017.76
8.1.30.0030.00617.87
8.1.20.0000.00817.81
8.1.10.0000.00717.73
8.1.00.0040.00417.63
8.0.300.0000.00818.77
8.0.290.0040.00417.00
8.0.280.0000.00718.55
8.0.270.0040.00417.51
8.0.260.0000.00817.44
8.0.250.0030.00317.39
8.0.240.0040.00417.31
8.0.230.0050.00317.23
8.0.220.0040.00417.11
8.0.210.0050.00217.24
8.0.200.0000.00817.29
8.0.190.0070.00017.33
8.0.180.0000.00717.31
8.0.170.0040.00417.33
8.0.160.0040.00417.31
8.0.150.0080.00017.11
8.0.140.0040.00317.18
8.0.130.0000.00513.54
8.0.120.0030.00617.30
8.0.110.0040.00417.21
8.0.100.0040.00417.15
8.0.90.0040.00317.16
8.0.80.0070.00717.21
8.0.70.0000.00917.28
8.0.60.0070.00017.20
8.0.50.0040.00417.38
8.0.30.0050.01217.34
8.0.20.0080.01317.40
8.0.10.0000.00717.36
8.0.00.0080.01317.12
7.4.330.0000.00416.81
7.4.320.0000.00716.80
7.4.300.0030.00316.84
7.4.290.0000.00816.73
7.4.280.0040.00416.64
7.4.270.0060.00316.83
7.4.260.0040.00416.83
7.4.250.0030.00516.73
7.4.240.0050.00316.76
7.4.230.0020.00516.79
7.4.220.0070.01116.77
7.4.210.0060.00916.62
7.4.200.0000.00716.91
7.4.160.0090.00617.17
7.4.150.0110.00817.40
7.4.140.0200.00317.86
7.4.130.0110.00816.88
7.4.120.0090.00916.83
7.4.110.0130.01016.98
7.4.100.0130.01016.77
7.4.90.0100.01017.04
7.4.80.0120.00619.39
7.4.70.0110.00616.86
7.4.60.0090.00916.91
7.4.50.0050.00516.97
7.4.40.0070.01016.98
7.4.30.0140.00716.68
7.4.00.0080.00815.10
7.3.330.0000.00613.59
7.3.320.0060.00013.44
7.3.310.0000.00816.47
7.3.300.0000.00716.53
7.3.290.0100.00716.55
7.3.280.0040.01516.55
7.3.270.0120.00617.40
7.3.260.0140.00616.85
7.3.250.0120.00816.65
7.3.240.0120.00816.71
7.3.230.0070.01116.62
7.3.210.0140.00616.80
7.3.200.0130.00316.72
7.3.190.0130.00316.78
7.3.180.0090.01216.68
7.3.170.0100.00616.66
7.3.160.0030.01316.78
7.3.120.0060.01015.21
7.3.110.0090.00615.17
7.3.100.0060.01015.01
7.3.90.0060.00615.03
7.3.80.0070.00415.28
7.3.70.0090.00615.09
7.3.60.0000.00914.81
7.3.50.0100.00314.88
7.3.40.0070.01015.18
7.3.30.0110.00415.14
7.3.20.0120.00316.92
7.3.10.0100.00716.86
7.3.00.0120.00516.75
7.2.330.0100.00716.76
7.2.320.0130.00316.67
7.2.310.0060.01116.98
7.2.300.0060.01216.89
7.2.290.0090.00717.11
7.2.250.0120.00315.27
7.2.240.0070.01315.46
7.2.230.0030.01315.19
7.2.220.0040.01115.24
7.2.210.0030.01115.14
7.2.200.0080.00815.03
7.2.190.0000.01315.13
7.2.180.0030.00915.30
7.2.170.0070.00415.22
7.2.130.0170.00716.60
7.2.120.0100.01016.77
7.2.110.0130.01316.70
7.2.100.0140.01016.71
7.2.90.0150.00416.98
7.2.80.0110.00816.73
7.2.70.0150.00716.98
7.2.60.0100.00917.05
7.2.50.0100.01017.13
7.2.40.0130.01016.92
7.2.30.0160.00717.07
7.2.20.0040.01217.30
7.2.10.0130.01017.14
7.2.00.0050.01018.48
7.1.330.0060.00316.11
7.1.320.0000.01015.89
7.1.310.0090.00315.87
7.1.300.0070.00416.11
7.1.290.0000.01015.82
7.1.280.0040.00815.85
7.1.270.0000.01515.84
7.1.260.0070.00716.20
7.1.250.0060.01015.82
7.1.240.0040.01415.91
7.1.230.0120.00615.63
7.1.220.0140.00315.60
7.1.210.0140.00315.72
7.1.200.0080.01015.91
7.1.190.0160.00515.84
7.1.180.0090.00615.69
7.1.170.0090.00315.75
7.1.160.0040.01115.89
7.1.150.0060.01215.44
7.1.140.0090.00915.74
7.1.130.0060.00616.12
7.1.120.0080.00615.54
7.1.110.0040.01515.98
7.1.100.0020.01017.09
7.1.90.0110.00515.96
7.1.80.0000.01715.99
7.1.70.0080.00516.46
7.1.60.0110.00817.54
7.1.50.0090.00916.38
7.1.40.0100.00515.69
7.1.30.0180.00015.93
7.1.20.0030.01515.80
7.1.10.0160.00416.07
7.1.00.0070.04019.16
7.0.330.0140.00415.11
7.0.320.0060.00815.41
7.0.310.0160.00315.34
7.0.300.0120.00615.49
7.0.290.0100.00715.21
7.0.280.0120.00615.02
7.0.270.0080.00415.61
7.0.260.0100.01015.73
7.0.250.0060.00915.14
7.0.240.0060.00615.52
7.0.230.0070.00715.41
7.0.220.0070.01015.41
7.0.210.0150.00415.42
7.0.200.0330.00615.13
7.0.190.0000.01415.31
7.0.180.0080.00415.38
7.0.170.0100.00315.31
7.0.160.0040.00815.62
7.0.150.0030.01015.51
7.0.140.0050.00515.47
7.0.130.0120.00615.62
7.0.120.0110.00015.54
7.0.110.0110.00315.30
7.0.100.0170.00415.24
7.0.90.0030.01015.32
7.0.80.0070.00715.48
7.0.70.0120.00815.13
7.0.60.0080.03818.53
7.0.50.0060.03116.67
7.0.40.0040.02816.87
7.0.30.0170.04216.72
7.0.20.0160.04116.72
7.0.10.0070.04916.93
7.0.00.0070.03216.83
5.6.380.0040.01214.30
5.6.370.0030.01314.44
5.6.360.0030.01013.97
5.6.350.0060.00914.61
5.6.340.0030.01614.34
5.6.330.0080.00414.52
5.6.320.0100.00314.53
5.6.310.0030.00914.25
5.6.300.0090.00314.46
5.6.290.0130.00314.51
5.6.280.0030.02117.65
5.6.270.0060.00914.48
5.6.260.0060.00914.44
5.6.250.0030.01014.33
5.6.240.0120.00414.63
5.6.230.0030.01014.35
5.6.220.0030.01014.29
5.6.210.0060.03517.51
5.6.200.0070.03716.28
5.6.190.0060.04517.50
5.6.180.0170.03617.40
5.6.170.0130.02917.57
5.6.160.0090.03717.50
5.6.150.0000.02816.35
5.6.140.0110.04316.19
5.6.130.0050.03816.32
5.6.120.0080.03017.66
5.6.110.0070.04017.84
5.6.100.0050.03717.68
5.6.90.0040.03117.65
5.6.80.0120.04017.54
5.6.70.0110.00314.24
5.6.60.0040.00814.48
5.6.50.0030.01014.03
5.6.40.0030.01014.34
5.6.30.0070.00314.32
5.6.20.0060.00914.17
5.6.10.0030.00914.61
5.6.00.0030.00914.31
5.5.380.0080.00411.02
5.5.370.0080.00511.10
5.5.360.0090.00310.91
5.5.350.0120.02716.00
5.5.340.0100.01814.64
5.5.330.0100.04015.80
5.5.320.0200.02315.78
5.5.310.0170.02315.76
5.5.300.0130.03114.60
5.5.290.0050.02514.40
5.5.280.0000.03916.22
5.5.270.0080.03316.21
5.5.260.0120.03915.99
5.5.250.0040.03115.92
5.5.240.0050.04315.67
5.5.230.0040.00811.07
5.5.220.0060.00610.93
5.5.210.0050.00810.82
5.5.200.0070.00811.34
5.5.190.0000.00811.00
5.5.180.0000.01311.02
5.5.170.0030.00611.03
5.5.160.0030.00610.70
5.5.150.0080.00010.63
5.5.140.0030.00811.05
5.5.130.0040.00711.17
5.5.120.0030.00810.82
5.5.110.0000.01011.11
5.5.100.0040.00710.98
5.5.90.0080.00410.95
5.5.80.0000.01411.13
5.5.70.0040.00811.02
5.5.60.0070.00410.70
5.5.50.0030.00610.67
5.5.40.0050.00511.00
5.5.30.0050.00510.80
5.5.20.0070.00410.98
5.5.10.0040.01111.18
5.5.00.0070.00711.00

preferences:
55.12 ms | 401 KiB | 5 Q