3v4l.org

run code in 300+ PHP versions simultaneously
<?php namespace SimonEq; interface ImageInterface { function getFileName(); } class Image implements ImageInterface { private $fileName; public function __construct($fileName) { $this->fileName = $fileName; } public function getFileName() { return $this->fileName; } } interface TransformationInterface { function transform(ImageInterface $image); } class TransformationAggregate implements TransformationInterface { private $transformationArray = []; public function __construct($transformationArray) { $this->transformationArray = $transformationArray; } public function transform(ImageInterface $image) { foreach ($this->transformationArray as $transformation) { $transformation->transform($image); } } } class CropTransformation implements TransformationInterface { private $width; private $height; public function __construct($width, $height) { $this->width = (int) $width; $this->height = (int) $height; } public function transform(ImageInterface $image) { printf('Image "%s" transformed with %s' . PHP_EOL, $image->getFileName(), print_r($this, true)); } } class ResizeTransformation implements TransformationInterface { private $width; private $height; private $resample; public function __construct($width, $height, $resample) { $this->width = (int) $width; $this->height = (int) $height; $this->resample = (bool) $resample; } public function transform(ImageInterface $image) { printf('Image "%s" transformed with %s' . PHP_EOL, $image->getFileName(), print_r($this, true)); } } class WatermarkTransformation implements TransformationInterface { private $image; public function __construct(ImageInterface $image) { $this->image = $image; } public function transform(ImageInterface $image) { printf('Image "%s" transformed with %s' . PHP_EOL, $image->getFileName(), print_r($this, true)); } } $image = new Image('FluffyCat.jpg'); $transformation = new TransformationAggregate([ new CropTransformation(200, 400), new WatermarkTransformation(new Image('MyWaterMark.png')), new ResizeTransformation(100, 200, true), ]); $transformation->transform($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.0030.01418.14
8.3.50.0080.00921.14
8.3.40.0070.01118.88
8.3.30.0100.01019.15
8.3.20.0140.00020.34
8.3.10.0000.00822.11
8.3.00.0040.00422.27
8.2.180.0080.01216.50
8.2.170.0040.01122.96
8.2.160.0040.01119.20
8.2.150.0060.00324.18
8.2.140.0050.00324.66
8.2.130.0090.00626.16
8.2.120.0080.00019.48
8.2.110.0070.00319.30
8.2.100.0090.00317.84
8.2.90.0040.00419.39
8.2.80.0060.00317.97
8.2.70.0060.00317.63
8.2.60.0040.00417.93
8.2.50.0030.00618.07
8.2.40.0060.00319.95
8.2.30.0070.00018.16
8.2.20.0040.00417.71
8.2.10.0080.00017.82
8.2.00.0080.00017.69
8.1.280.0100.01025.92
8.1.270.0040.00422.31
8.1.260.0000.00826.35
8.1.250.0000.00828.09
8.1.240.0050.00522.24
8.1.230.0100.00019.05
8.1.220.0040.00417.74
8.1.210.0000.00818.77
8.1.200.0060.00317.48
8.1.190.0040.00417.48
8.1.180.0050.00318.86
8.1.170.0060.00318.69
8.1.160.0000.00822.05
8.1.150.0000.00818.55
8.1.140.0000.00717.52
8.1.130.0000.00717.78
8.1.120.0000.00717.48
8.1.110.0040.00417.51
8.1.100.0000.00817.52
8.1.90.0000.00717.49
8.1.80.0000.00817.57
8.1.70.0030.00317.39
8.1.60.0060.00317.59
8.1.50.0000.00917.58
8.1.40.0040.00417.60
8.1.30.0000.00917.65
8.1.20.0050.00317.64
8.1.10.0000.00717.52
8.1.00.0000.00817.46
8.0.300.0000.00718.77
8.0.290.0040.00417.00
8.0.280.0070.00018.40
8.0.270.0000.00717.21
8.0.260.0070.00017.00
8.0.250.0030.00517.09
8.0.240.0040.00417.09
8.0.230.0040.00416.98
8.0.220.0040.00416.93
8.0.210.0000.00716.92
8.0.200.0000.00617.09
8.0.190.0000.00717.07
8.0.180.0000.00716.92
8.0.170.0040.00416.93
8.0.160.0070.00016.93
8.0.150.0040.00417.06
8.0.140.0040.00417.00
8.0.130.0080.00013.38
8.0.120.0000.00816.99
8.0.110.0000.00716.90
8.0.100.0040.00417.13
8.0.90.0050.00317.05
8.0.80.0060.00917.01
8.0.70.0040.00417.13
8.0.60.0040.00416.96
8.0.50.0040.00416.86
8.0.30.0060.01317.18
8.0.20.0080.01117.40
8.0.10.0040.00417.00
8.0.00.0100.01016.79
7.4.330.0030.00315.00
7.4.320.0060.00016.58
7.4.300.0030.00516.57
7.4.290.0040.00416.57
7.4.280.0070.00016.64
7.4.270.0030.00316.55
7.4.260.0040.00416.67
7.4.250.0040.00416.44
7.4.240.0050.00216.69
7.4.230.0070.00016.77
7.4.220.0120.00616.68
7.4.210.0050.01016.63
7.4.200.0000.00716.36
7.4.190.0040.00416.66
7.4.160.0050.01116.59
7.4.150.0040.01317.40
7.4.140.0070.01317.86
7.4.130.0090.01116.61
7.4.120.0090.00916.57
7.4.110.0090.00916.48
7.4.100.0140.00416.34
7.4.90.0100.00716.75
7.4.80.0090.00919.39
7.4.70.0060.01316.53
7.4.60.0100.00616.62
7.4.50.0050.00316.46
7.4.40.0070.01022.77
7.4.30.0000.01716.69
7.4.00.0060.01014.99
7.3.330.0030.00313.29
7.3.320.0050.00013.18
7.3.310.0040.00416.23
7.3.300.0070.00016.34
7.3.290.0070.00716.30
7.3.280.0090.00916.33
7.3.270.0140.00617.40
7.3.260.0120.00616.26
7.3.250.0180.00716.33
7.3.240.0060.01016.50
7.3.230.0140.00316.57
7.3.210.0110.00716.41
7.3.200.0140.00819.39
7.3.190.0150.00316.38
7.3.180.0090.00616.45
7.3.170.0100.00616.50
7.3.160.0130.00316.40
7.3.120.0080.00814.50
7.2.330.0000.01716.85
7.2.320.0150.00316.53
7.2.310.0060.01216.77
7.2.300.0070.01016.67
7.2.290.0070.01016.91
7.2.60.0170.00017.04
7.2.00.0000.01219.49
7.1.200.0030.01015.69
7.1.100.0040.00417.94
7.1.70.0000.00917.16
7.1.60.0120.01219.82
7.1.50.0060.01316.99
7.1.00.0000.03722.34
7.0.200.0030.00716.88
7.0.140.0030.07321.93
7.0.110.0070.05320.14
7.0.100.0030.08319.97
7.0.90.0100.07719.96
7.0.80.0130.07719.93
7.0.70.0070.03719.97
7.0.60.0070.04019.97
7.0.50.0200.07320.04
7.0.40.0030.08719.74
7.0.30.0030.06019.80
7.0.20.0130.07319.70
7.0.10.0100.05019.69
7.0.00.0100.07019.71
5.6.280.0030.07321.18
5.6.260.0200.07320.71
5.6.250.0130.04720.71
5.6.240.0130.08020.70
5.6.230.0100.08020.59
5.6.220.0130.08020.53
5.6.210.0130.06020.64
5.6.200.0070.08320.59
5.6.190.0130.07020.59
5.6.180.0130.07320.59
5.6.170.0100.07320.65
5.6.160.0200.07020.66
5.6.150.0130.07320.66
5.6.140.0070.08320.73
5.6.130.0170.07020.57
5.6.120.0070.08020.64
5.6.110.0070.08320.57
5.6.100.0100.08020.87
5.6.90.0070.06720.70
5.6.80.0100.08020.01
5.6.70.0030.06720.25
5.6.60.0100.07020.10
5.6.50.0070.08020.27
5.6.40.0100.07319.98
5.6.30.0030.06020.24
5.6.20.0170.07019.94
5.6.10.0070.08019.94
5.6.00.0130.07319.86
5.5.380.0130.07320.59
5.5.370.0130.08020.44
5.5.360.0070.06720.56
5.5.350.0030.07720.48
5.5.340.0030.08721.06
5.5.330.0100.07020.86
5.5.320.0070.07720.95
5.5.310.0070.05320.92
5.5.300.0030.07720.73
5.5.290.0300.06020.98
5.5.280.0130.06720.72
5.5.270.0170.06320.93
5.5.260.0100.06720.80
5.5.250.0030.08020.61
5.5.240.0070.07720.37
5.5.230.0030.05320.27
5.5.220.0100.08320.30
5.5.210.0100.08020.36
5.5.200.0100.07320.20
5.5.190.0100.06320.12
5.5.180.0070.08320.25
5.5.160.0070.06320.38
5.5.150.0030.06720.28
5.5.140.0100.03720.27
5.5.130.0070.04320.41
5.5.120.0100.04720.41
5.5.110.0070.05020.27
5.5.100.0130.07020.02
5.5.90.0130.07020.18
5.5.80.0130.03720.08
5.5.70.0130.06020.18
5.5.60.0130.06720.12
5.5.50.0130.05020.02
5.5.40.0130.07020.22
5.5.30.0030.08020.02
5.5.20.0100.07720.15
5.5.10.0030.08020.03
5.5.00.0030.08320.08
5.4.450.0100.06319.56
5.4.440.0170.04019.56
5.4.430.0100.05019.46
5.4.420.0030.08019.31
5.4.410.0130.06319.39
5.4.400.0130.07019.02
5.4.390.0000.08018.97
5.4.380.0070.07019.23
5.4.370.0070.07319.01
5.4.360.0030.08019.16
5.4.350.0070.07019.10
5.4.340.0030.08319.32
5.4.320.0130.04019.10
5.4.310.0100.04319.04
5.4.300.0030.08019.09
5.4.290.0170.06319.32
5.4.280.0130.07019.18
5.4.270.0000.08318.96
5.4.260.0070.07719.16
5.4.250.0070.05319.18
5.4.240.0070.07319.14
5.4.230.0100.07719.31
5.4.220.0070.07019.00
5.4.210.0030.07719.00
5.4.200.0100.06719.00
5.4.190.0070.07319.31
5.4.180.0170.06719.00
5.4.170.0100.06318.99
5.4.160.0130.05019.15
5.4.150.0000.04319.33
5.4.140.0000.04016.45
5.4.130.0030.03716.35
5.4.120.0000.04716.63
5.4.110.0030.03716.53
5.4.100.0100.05316.47
5.4.90.0030.03716.49
5.4.80.0030.03716.36
5.4.70.0030.04316.66
5.4.60.0000.07016.54
5.4.50.0000.03716.56
5.4.40.0070.03316.60
5.4.30.0030.04316.63
5.4.20.0030.07016.63
5.4.10.0070.05716.53
5.4.00.0000.04315.95
5.3.290.0100.07014.82
5.3.280.0170.07014.61
5.3.270.0100.07014.84
5.3.260.0030.04014.61
5.3.250.0000.04014.74
5.3.240.0000.04014.63
5.3.230.0070.04314.73
5.3.220.0130.04714.53
5.3.210.0000.05014.72
5.3.200.0030.03714.61
5.3.190.0070.06314.70
5.3.180.0000.05014.67
5.3.170.0030.05714.57
5.3.160.0070.03314.58
5.3.150.0030.03014.57
5.3.140.0100.03014.57
5.3.130.0070.08014.64
5.3.120.0030.07014.70
5.3.110.0070.04714.55
5.3.100.0100.03314.05
5.3.90.0000.04013.99
5.3.80.0030.07013.98
5.3.70.0030.04013.88
5.3.60.0070.03714.24
5.3.50.0100.03013.97
5.3.40.0070.03313.91
5.3.30.0070.03313.77
5.3.20.0000.03713.76
5.3.10.0030.03313.76
5.3.00.0030.03313.62
5.2.170.0030.03011.50
5.2.160.0000.04011.50
5.2.150.0070.02711.50
5.2.140.0000.03011.50
5.2.130.0000.04011.50
5.2.120.0000.03011.50
5.2.110.0030.02711.50
5.2.100.0130.03011.50
5.2.90.0000.03311.50
5.2.80.0000.05311.50
5.2.70.0030.03011.50
5.2.60.0000.03011.50
5.2.50.0000.03011.50
5.2.40.0000.03011.50
5.2.30.0030.05711.50
5.2.20.0000.03011.50
5.2.10.0070.02311.50
5.2.00.0000.03711.50
5.1.60.0000.03011.50
5.1.50.0030.02311.50
5.1.40.0070.02011.50
5.1.30.0000.03311.50
5.1.20.0000.03711.50
5.1.10.0000.02711.50
5.1.00.0000.02711.50
5.0.50.0000.04711.50
5.0.40.0030.03011.50
5.0.30.0000.03311.50
5.0.20.0000.02011.50
5.0.10.0000.02311.50
5.0.00.0000.03311.50
4.4.90.0000.01711.50
4.4.80.0030.01311.50
4.4.70.0000.01711.50
4.4.60.0030.03311.50
4.4.50.0000.01711.50
4.4.40.0000.02311.50
4.4.30.0000.01711.50
4.4.20.0030.01311.50
4.4.10.0030.01311.50
4.4.00.0000.02311.50
4.3.110.0030.01311.50
4.3.100.0000.01711.50
4.3.90.0000.01311.50
4.3.80.0000.02711.50
4.3.70.0030.02011.50
4.3.60.0030.01011.50
4.3.50.0000.01711.50
4.3.40.0030.03311.50
4.3.30.0000.03011.50
4.3.20.0000.03011.50
4.3.10.0000.03711.50
4.3.00.0070.03011.50

preferences:
47.7 ms | 401 KiB | 5 Q