3v4l.org

run code in 300+ PHP versions simultaneously
<?php class ColorShifter{ private $colors; public function __construct($colors) { $this->colors = new ArrayObject($colors); } public function getNext() { $this->colors->getIterator()->next(); return $this->colors->getIterator()->current(); } } $imageWidth = 300; $imageHeight = 350; $image = imagecreate($imageWidth, $imageHeight); $red = imagecolorallocate($image, 255, 10 , 10); $blue = imagecolorallocate($image, 10, 10 , 255); $gold = imagecolorallocate($image, 255, 240, 0); $colors = new ArrayObject(array($red, $blue, $gold)); $iterator = $colors->getIterator(); for($i = 0; $i<$imageWidth; $i += 10){ if(!$iterator->valid()) $iterator->rewind(); $iterator->next(); imagefilledrectangle($image, 0 , 0, $imageWidth - $i , $imageHeight-$i, $iterator->current()); } $iterator->next(); imagefilledrectangle($image, 0, 0, 10, 10, $iterator->current()); imagepng($image); header('Content-Type: image/png'); echo $image;

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.50
8.3.50.0100.00716.39
8.3.40.0120.00318.63
8.3.30.0140.00018.67
8.3.20.0070.00020.21
8.3.10.0000.00823.66
8.3.00.0030.00521.85
8.2.180.0140.00716.75
8.2.170.0060.00922.96
8.2.160.0070.00720.33
8.2.150.0080.00024.18
8.2.140.0050.00324.66
8.2.130.0080.00021.12
8.2.120.0000.00826.35
8.2.110.0030.00621.19
8.2.100.0090.00317.80
8.2.90.0000.00819.23
8.2.80.0040.00417.97
8.2.70.0030.00617.63
8.2.60.0040.00417.92
8.2.50.0090.00018.09
8.2.40.0030.00522.38
8.2.30.0000.00719.44
8.2.20.0000.00917.59
8.2.10.0070.00018.07
8.2.00.0040.00418.07
8.1.280.0150.00925.92
8.1.270.0030.00622.10
8.1.260.0080.00028.09
8.1.250.0000.00728.09
8.1.240.0090.00022.48
8.1.230.0080.00319.16
8.1.220.0000.00817.74
8.1.210.0000.00818.77
8.1.200.0030.00617.35
8.1.190.0030.00617.23
8.1.180.0040.00418.10
8.1.170.0040.00418.51
8.1.160.0070.00020.80
8.1.150.0000.00718.86
8.1.140.0030.00519.50
8.1.130.0000.00717.66
8.1.120.0030.00617.50
8.1.110.0080.00017.32
8.1.100.0050.00217.47
8.1.90.0000.00717.43
8.1.80.0000.00817.31
8.1.70.0000.00717.36
8.1.60.0000.01117.48
8.1.50.0070.00017.43
8.1.40.0000.00717.43
8.1.30.0040.00417.59
8.1.20.0040.00417.67
8.1.10.0000.00817.61
8.1.00.0050.00317.52
8.0.300.0040.00418.77
8.0.290.0070.00016.75
8.0.280.0070.00018.32
8.0.270.0000.00717.10
8.0.260.0000.00817.22
8.0.250.0000.00717.01
8.0.240.0040.00416.99
8.0.230.0030.00316.91
8.0.220.0000.00716.96
8.0.210.0000.00816.82
8.0.200.0000.00716.93
8.0.190.0060.00316.97
8.0.180.0030.00916.88
8.0.170.0040.00416.91
8.0.160.0040.00416.83
8.0.150.0040.00316.76
8.0.140.0030.00516.89
8.0.130.0060.00013.40
8.0.120.0090.00016.85
8.0.110.0040.00416.92
8.0.100.0040.00416.76
8.0.90.0030.00416.73
8.0.80.0030.01216.82
8.0.70.0030.00616.77
8.0.60.0040.00417.00
8.0.50.0070.00016.73
8.0.30.0100.01116.91
8.0.20.0110.00917.40
8.0.10.0040.00417.10
8.0.00.0070.01116.65
7.4.330.0050.00016.79
7.4.320.0060.00016.53
7.4.300.0000.00916.63
7.4.290.0000.00916.49
7.4.280.0000.00716.54
7.4.270.0030.00316.61
7.4.260.0070.00416.42
7.4.250.0050.00316.46
7.4.240.0000.00716.53
7.4.230.0040.00416.72
7.4.220.0100.01516.48
7.4.210.0040.01416.73
7.4.200.0030.00516.70
7.4.160.0000.01716.32
7.4.150.0070.01117.40
7.4.140.0100.01217.86
7.4.130.0080.00816.60
7.4.120.0130.00716.54
7.4.110.0140.00316.64
7.4.100.0140.01016.64
7.4.90.0030.01316.50
7.4.80.0140.00319.39
7.4.70.0100.00716.47
7.4.60.0100.00716.52
7.4.50.0070.01016.34
7.4.40.0110.00616.39
7.4.30.0160.00716.37
7.4.00.0090.00615.10
7.3.330.0000.00513.33
7.3.320.0030.00313.16
7.3.310.0000.00716.35
7.3.300.0000.00716.27
7.3.290.0060.00016.18
7.3.280.0040.01016.32
7.3.270.0060.01217.40
7.3.260.0070.01016.37
7.3.250.0090.00816.47
7.3.240.0070.01016.32
7.3.230.0040.01216.47
7.3.210.0140.00316.35
7.3.200.0100.01219.39
7.3.190.0130.00516.41
7.3.180.0060.01216.29
7.3.170.0070.01016.40
7.3.160.0110.00516.62
7.2.330.0150.00316.35
7.2.320.0140.00316.48
7.2.310.0150.00616.35
7.2.300.0140.00316.68
7.2.290.0100.00716.36
7.2.60.0040.01116.68
7.2.00.0030.00919.50
7.1.200.0070.00715.60
7.1.100.0030.00918.00
7.1.70.0000.00816.90
7.1.60.0110.01519.40
7.1.50.0150.00616.80
7.1.00.0030.07022.32
7.0.200.0760.00014.41
7.0.60.0270.06321.66
7.0.50.0100.07717.93
7.0.40.0070.08320.09
7.0.30.0330.06320.07
7.0.20.0400.07320.17
7.0.10.0030.05020.06
7.0.00.0130.04020.20
5.6.280.0000.06321.01
5.6.210.0070.08020.72
5.6.200.0130.07718.27
5.6.190.0070.08720.52
5.6.180.0300.07320.33
5.6.170.0300.07720.46
5.6.160.0030.08720.55
5.6.150.0030.04318.21
5.6.140.0170.07318.15
5.6.130.0000.04318.23
5.6.120.0100.08020.98
5.6.110.0100.07321.13
5.6.100.0130.07721.04
5.6.90.0070.08320.89
5.6.80.0070.05320.42
5.5.350.0130.04020.54
5.5.340.0070.03717.96
5.5.330.0170.07320.23
5.5.320.0370.04320.28
5.5.310.0400.07320.29
5.5.300.0130.07318.04
5.5.290.0000.08717.95
5.5.280.0070.08320.83
5.5.270.0100.07720.88
5.5.260.0070.08320.91
5.5.250.0100.07720.79
5.5.240.0130.03720.17

preferences:
87.21 ms | 400 KiB | 5 Q