3v4l.org

run code in 300+ PHP versions simultaneously
<?php namespace Test; class SegmentCollection { private $segmentArray = []; public function __construct(array $segmentArray) { $this->segmentArray = $segmentArray; } public function popSegment() { return array_pop($this->segmentArray); } public function shiftSegment() { return array_shift($this->segmentArray); } } interface SegmentReader { public function getNextSegment(); } abstract class SegmentReaderBase implements SegmentReader { protected $segmentCollection; public function __construct(SegmentCollection $segmentCollection) { $this->segmentCollection = $segmentCollection; } } class PopSegmentReader extends SegmentReaderBase { public function getNextSegment() { return $this->segmentCollection->popSegment(); } } class ShiftSegmentReader extends SegmentReaderBase { public function getNextSegment() { return $this->segmentCollection->shiftSegment(); } } function acceptSegmentReader(SegmentReader $segmentReader) { var_dump($segmentReader->getNextSegment()); var_dump($segmentReader->getNextSegment()); } $segmentCollection = new SegmentCollection(['foo', 'bar', 'qux', 'zip']); acceptSegmentReader(new PopSegmentReader($segmentCollection)); acceptSegmentReader(new ShiftSegmentReader($segmentCollection));

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.0040.01118.30
8.3.50.0040.01421.15
8.3.40.0070.01418.71
8.3.30.0110.00319.09
8.3.20.0050.00320.39
8.3.10.0040.00422.09
8.3.00.0080.00022.44
8.2.180.0060.01216.63
8.2.170.0080.00822.96
8.2.160.0100.00320.39
8.2.150.0040.00424.18
8.2.140.0040.00424.66
8.2.130.0140.00426.16
8.2.120.0040.00419.66
8.2.110.0030.00622.25
8.2.100.0090.00317.78
8.2.90.0030.00517.72
8.2.80.0090.00019.17
8.2.70.0060.00317.50
8.2.60.0070.00717.80
8.2.50.0060.00318.07
8.2.40.0000.00718.22
8.2.30.0000.00818.11
8.2.20.0030.00517.54
8.2.10.0040.00417.57
8.2.00.0070.00317.66
8.1.280.0140.00325.92
8.1.270.0000.00820.46
8.1.260.0000.00826.35
8.1.250.0070.00028.09
8.1.240.0000.00923.82
8.1.230.0120.00022.70
8.1.220.0080.00017.74
8.1.210.0000.00818.77
8.1.200.0030.00617.47
8.1.190.0040.00417.54
8.1.180.0030.00520.33
8.1.170.0050.00318.55
8.1.160.0040.00422.08
8.1.150.0040.00418.57
8.1.140.0070.00017.35
8.1.130.0000.00717.89
8.1.120.0040.00417.53
8.1.110.0000.00817.45
8.1.100.0040.00417.36
8.1.90.0070.00017.42
8.1.80.0000.00817.46
8.1.70.0000.00717.45
8.1.60.0000.00817.61
8.1.50.0000.00817.52
8.1.40.0070.00017.52
8.1.30.0000.00717.48
8.1.20.0080.00017.58
8.1.10.0050.00317.43
8.1.00.0080.00317.42
8.0.300.0070.00020.09
8.0.290.0030.00516.75
8.0.280.0000.00818.46
8.0.270.0030.00317.29
8.0.260.0030.00316.90
8.0.250.0030.00317.06
8.0.240.0000.00816.95
8.0.230.0030.00317.02
8.0.220.0000.00716.96
8.0.210.0030.00316.93
8.0.200.0030.00317.02
8.0.190.0030.00617.05
8.0.180.0000.00717.05
8.0.170.0060.00316.88
8.0.160.0080.00016.98
8.0.150.0080.00017.02
8.0.140.0000.01016.82
8.0.130.0030.00313.40
8.0.120.0080.00016.82
8.0.110.0000.00716.86
8.0.100.0040.00416.96
8.0.90.0030.00516.96
8.0.80.0090.00616.98
8.0.70.0000.00816.84
8.0.60.0000.00716.95
8.0.50.0040.00416.81
8.0.30.0130.01217.14
8.0.20.0150.00317.40
8.0.10.0050.00517.21
8.0.00.0050.01216.67
7.4.330.0030.00315.00
7.4.320.0060.00016.61
7.4.300.0030.00316.61
7.4.290.0040.00416.52
7.4.280.0000.00716.42
7.4.270.0030.00316.61
7.4.260.0040.00416.61
7.4.250.0040.00416.59
7.4.240.0020.00516.58
7.4.230.0070.00016.51
7.4.220.0090.01016.66
7.4.210.0070.01016.65
7.4.200.0040.00416.68
7.4.190.0030.00316.66
7.4.160.0070.01416.55
7.4.150.0040.01417.40
7.4.140.0100.00817.86
7.4.130.0130.00416.49
7.4.120.0100.00716.46
7.4.110.0060.01216.66
7.4.100.0130.00616.57
7.4.90.0030.01416.37
7.4.80.0100.00719.39
7.4.70.0090.00916.51
7.4.60.0030.02016.52
7.4.50.0040.00016.79
7.4.40.0090.00922.77
7.4.30.0060.01116.48
7.4.00.0050.01315.04
7.3.330.0050.00013.32
7.3.320.0020.00213.07
7.3.310.0000.00716.39
7.3.300.0000.00716.32
7.3.290.0090.01216.31
7.3.280.0090.00816.25
7.3.270.0060.00917.40
7.3.260.0100.00816.38
7.3.250.0090.00816.60
7.3.240.0070.01416.39
7.3.230.0110.00716.39
7.3.210.0030.01316.17
7.3.200.0060.01019.39
7.3.190.0060.01216.43
7.3.180.0070.01016.38
7.3.170.0080.00816.30
7.3.160.0120.00316.34
7.3.120.0030.01414.81
7.3.110.0110.00614.86
7.3.100.0090.00514.89
7.3.90.0080.00514.67
7.3.80.0060.00614.70
7.3.70.0050.00814.76
7.3.60.0070.00614.79
7.3.50.0040.01014.85
7.3.40.0090.00514.64
7.3.30.0070.00614.67
7.3.20.0060.00916.69
7.3.10.0060.00816.50
7.3.00.0070.00816.56
7.2.330.0100.01016.79
7.2.320.0120.00616.64
7.2.310.0090.00916.41
7.2.300.0110.01116.71
7.2.290.0130.00316.50
7.2.250.0060.01114.96
7.2.240.0090.00915.00
7.2.230.0050.01015.15
7.2.220.0050.00715.02
7.2.210.0070.00715.02
7.2.200.0060.00715.08
7.2.190.0030.00915.11
7.2.180.0060.00815.08
7.2.170.0060.00914.97
7.2.00.0000.01419.53
7.1.330.0060.00815.98
7.1.320.0050.00515.79
7.1.310.0040.01015.66
7.1.300.0110.00715.72
7.1.290.0040.01115.77
7.1.280.0090.00615.68
7.1.270.0060.00615.66
7.1.260.0080.00615.85
7.1.100.0380.00617.93
7.1.70.0030.00716.99
7.1.60.0070.01719.82
7.1.50.0100.01316.92
7.1.00.0000.05022.44
7.0.200.0000.01016.80
7.0.140.0000.07722.21
7.0.60.0200.07319.94
7.0.50.0070.08317.91
7.0.40.0170.07020.02
7.0.30.0430.06020.26
7.0.20.0130.07720.24
7.0.10.0000.05720.24
7.0.00.0100.08020.07
5.6.280.0100.06721.06
5.6.210.0070.08020.59
5.6.200.0030.04018.24
5.6.190.0000.04320.61
5.6.180.0400.07720.68
5.6.170.0500.05720.61
5.6.160.0100.05720.61
5.6.150.0030.08318.25
5.6.140.0070.08318.21
5.6.130.0030.06318.14
5.6.120.0100.08020.78
5.6.110.0100.03720.91
5.6.100.0100.08321.06
5.6.90.0270.07021.02
5.6.80.0100.07720.40
5.5.350.0130.07320.34
5.5.340.0030.04017.98
5.5.330.0030.04320.38
5.5.320.0270.04720.27
5.5.310.0300.04320.51
5.5.300.0100.08017.98
5.5.290.0070.08018.01
5.5.280.0030.04720.98
5.5.270.0100.04320.68
5.5.260.0130.05720.97
5.5.250.0000.08020.68
5.5.240.0100.08020.25
5.4.450.0430.03719.47
5.4.440.0430.05019.41
5.4.430.0570.06319.54
5.4.420.0400.04019.40
5.4.410.0570.06719.18
5.4.400.0470.06718.86
5.4.390.0700.04319.13
5.4.380.0530.06318.87
5.4.370.0530.05719.22
5.4.360.0370.04318.98
5.4.350.0470.05318.85
5.4.340.0500.05719.22
5.4.320.0500.06019.26
5.4.310.0470.03719.24
5.4.300.0500.04319.08
5.4.290.0570.05319.09
5.4.280.0530.06319.31
5.4.270.0570.06318.98
5.4.260.0470.04718.87
5.4.250.0570.05719.24
5.4.240.0570.06019.23
5.4.230.0470.07718.97
5.4.220.0430.07018.94
5.4.210.0470.06719.21
5.4.200.0500.06318.93
5.4.190.0370.07019.30
5.4.180.0300.04319.23
5.4.170.0530.07319.08
5.4.160.0500.06319.08
5.4.150.0430.05019.07
5.4.140.0470.05716.56
5.4.130.0470.06716.42
5.4.120.0500.04316.42
5.4.110.0500.05016.24
5.4.100.0400.03716.31
5.4.90.0570.06016.32
5.4.80.0430.04316.62
5.4.70.0570.06716.59
5.4.60.0470.04716.54
5.4.50.0470.03716.56
5.4.40.0430.04716.16
5.4.30.0500.04316.50
5.4.20.0500.06716.52
5.4.10.0570.06016.51
5.4.00.0530.06315.73
5.3.290.0530.06314.69
5.3.280.0470.06714.67
5.3.270.0570.06314.69
5.3.260.0600.05714.72
5.3.250.0470.04314.50
5.3.240.0470.06714.82
5.3.230.0530.05714.50
5.3.220.0600.06014.61
5.3.210.0430.04014.64
5.3.200.0670.05014.64
5.3.190.0430.03714.57
5.3.180.0600.05714.63
5.3.170.0570.04014.53
5.3.160.0430.05314.61
5.3.150.0430.03314.48
5.3.140.0330.04314.57
5.3.130.0430.04314.77
5.3.120.0530.05014.52
5.3.110.0470.06314.57
5.3.100.0430.04014.04
5.3.90.0430.05313.99
5.3.80.0470.03714.12
5.3.70.0500.05714.09
5.3.60.0470.04313.90
5.3.50.0400.04013.84
5.3.40.0570.06313.99
5.3.30.0400.06713.82
5.3.20.0530.06313.73
5.3.10.0430.05313.75
5.3.00.0400.04013.54
5.2.170.0330.03011.00
5.2.160.0400.03311.16
5.2.150.0400.05011.00
5.2.140.0500.05011.15
5.2.130.0370.04710.96
5.2.120.0430.06010.95
5.2.110.0600.02711.14
5.2.100.0430.05310.94
5.2.90.0400.05011.15
5.2.80.0430.05311.25
5.2.70.0370.04011.10
5.2.60.0530.02310.98
5.2.50.0400.05310.86
5.2.40.0330.05311.08
5.2.30.0270.03710.81
5.2.20.0400.03011.00
5.2.10.0370.05710.75
5.2.00.0300.03010.74
5.1.60.0400.0439.98
5.1.50.0370.0309.89
5.1.40.0370.0479.95
5.1.30.0300.03010.43
5.1.20.0430.04710.44
5.1.10.0400.04710.00
5.1.00.0300.03010.15
5.0.50.0230.0409.80
5.0.40.0200.0409.80
5.0.30.0130.0479.80
5.0.20.0130.0209.80
5.0.10.0200.0139.80
5.0.00.0170.0279.80
4.4.90.0130.0179.80
4.4.80.0230.0179.80
4.4.70.0200.0309.80
4.4.60.0200.0239.80
4.4.50.0170.0279.80
4.4.40.0170.0309.80
4.4.30.0130.0209.80
4.4.20.0170.0239.80
4.4.10.0170.0139.80
4.4.00.0170.0479.80
4.3.110.0200.0239.80
4.3.100.0130.0179.80
4.3.90.0170.0179.80
4.3.80.0100.0279.80
4.3.70.0130.0139.80
4.3.60.0100.0179.80
4.3.50.0070.0209.80
4.3.40.0130.0279.80
4.3.30.0070.0139.80
4.3.20.0030.0179.80
4.3.10.0030.0179.80
4.3.00.0030.0179.80

preferences:
45.45 ms | 401 KiB | 5 Q