3v4l.org

run code in 300+ PHP versions simultaneously
<?php interface GoAlgorithm { public function go(); } class GoByDrivingAlgorithm implements GoAlgorithm { public function go() { echo "Now I'm driving." .PHP_EOL; } } class GoByFlying implements GoAlgorithm { public function go() { echo "Now I'm flying." . PHP_EOL; } } class GoByFlyingFast implements GoAlgorithm { public function go() { echo "Now I'm flying fast" . PHP_EOL; } } class Vehicle { private $goAlgorithm; public function __construct(GoAlgorithm $goType = null) { $this->goAlgorithm = $goType; } public function setModeOfTransportation(GoAlgorithm $goType) { $this->goAlgorithm = $goType; } public function drive() { return $this->goAlgorithm->go(); } } // setter injection $streetRacer = new Vehicle(); $streetRacer->setModeOfTransportation(new GoByDrivingAlgorithm()); $formulaone = new Vehicle(); $formulaone->setModeOfTransportation(new GoByDrivingAlgorithm()); $helicopter = new Vehicle(); $helicopter->setModeOfTransportation(new GoByFlying()); $jets = new Vehicle(); $jets->setModeOfTransportation(new GoByFlyingFast()); $streetRacer->drive(); $formulaone->drive(); $helicopter->drive(); $jets->drive(); // constructor injection $streetRacerByCtor = new Vehicle(new GoByDrivingAlgorithm()); $formulaoneByCtor = new Vehicle(new GoByDrivingAlgorithm()); $helicopterByCtor = new Vehicle(new GoByFlying()); $jetsByCtor = new Vehicle(new GoByFlyingFast()); $streetRacerByCtor->drive(); $formulaoneByCtor->drive(); $helicopterByCtor->drive(); $jetsByCtor->drive();

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.70.0080.00816.63
8.3.60.0160.00016.73
8.3.50.0130.00422.80
8.3.40.0120.00320.58
8.3.30.0040.01119.09
8.3.20.0040.00420.38
8.3.10.0040.00423.48
8.3.00.0040.00419.38
8.2.180.0060.00916.75
8.2.170.0110.00422.96
8.2.160.0070.00720.47
8.2.150.0040.00424.18
8.2.140.0040.00424.66
8.2.130.0050.00326.16
8.2.120.0040.00421.12
8.2.110.0060.00320.58
8.2.100.0040.00817.72
8.2.90.0030.00618.28
8.2.80.0030.00617.97
8.2.70.0080.00417.50
8.2.60.0000.00817.93
8.2.50.0000.00818.07
8.2.40.0000.00818.28
8.2.30.0000.00818.07
8.2.20.0000.00717.82
8.2.10.0000.00818.15
8.2.00.0030.00517.66
8.1.280.0110.00325.92
8.1.270.0030.00623.88
8.1.260.0090.00328.09
8.1.250.0000.00828.09
8.1.240.0140.00722.14
8.1.230.0090.00320.88
8.1.220.0030.00617.74
8.1.210.0050.00518.98
8.1.200.0060.00317.47
8.1.190.0000.00817.35
8.1.180.0000.00818.10
8.1.170.0040.00418.77
8.1.160.0000.00821.99
8.1.150.0040.00418.93
8.1.140.0050.00217.61
8.1.130.0030.00317.89
8.1.120.0070.00017.44
8.1.110.0060.00317.50
8.1.100.0040.00417.39
8.1.90.0000.00717.56
8.1.80.0050.00217.43
8.1.70.0000.00717.50
8.1.60.0000.00817.68
8.1.50.0040.00417.53
8.1.40.0000.00817.54
8.1.30.0000.00817.71
8.1.20.0100.00017.71
8.1.10.0000.00717.64
8.1.00.0000.00717.53
8.0.300.0080.00020.20
8.0.290.0040.00416.88
8.0.280.0030.00318.36
8.0.270.0030.00317.33
8.0.260.0060.00017.31
8.0.250.0000.00817.07
8.0.240.0030.00517.18
8.0.230.0040.00417.07
8.0.220.0040.00417.08
8.0.210.0070.00317.07
8.0.200.0040.00417.05
8.0.190.0050.00517.09
8.0.180.0040.00416.96
8.0.170.0000.00817.03
8.0.160.0070.00017.07
8.0.150.0040.00417.00
8.0.140.0040.00416.95
8.0.130.0000.00613.45
8.0.120.0040.00416.95
8.0.110.0040.00417.04
8.0.100.0000.00816.88
8.0.90.0040.00416.83
8.0.80.0040.01416.98
8.0.70.0040.00417.08
8.0.60.0030.00616.86
8.0.50.0040.00416.94
8.0.30.0130.00617.12
8.0.20.0110.00917.43
8.0.10.0030.00517.02
8.0.00.0080.01116.87
7.4.330.0030.00315.00
7.4.320.0030.00316.48
7.4.300.0000.00616.61
7.4.290.0030.00316.71
7.4.280.0040.00416.56
7.4.270.0000.00816.56
7.4.260.0030.00616.54
7.4.250.0000.00716.63
7.4.240.0030.00316.68
7.4.230.0000.00716.46
7.4.220.0090.00916.64
7.4.210.0040.01116.51
7.4.200.0080.00016.57
7.4.160.0140.00416.67
7.4.150.0140.00317.40
7.4.140.0180.00917.86
7.4.130.0160.00516.57
7.4.120.0110.00816.47
7.4.110.0130.00616.55
7.4.100.0100.01016.71
7.4.90.0080.00916.54
7.4.80.0090.00919.39
7.4.70.0090.01416.61
7.4.60.0000.01716.53
7.4.50.0050.00316.23
7.4.40.0060.01016.50
7.4.30.0080.00816.62
7.4.00.0070.01115.03
7.3.330.0040.00413.10
7.3.320.0030.00313.34
7.3.310.0030.00316.27
7.3.300.0040.00416.26
7.3.290.0100.01016.25
7.3.280.0050.01116.22
7.3.270.0170.00317.40
7.3.260.0110.00716.32
7.3.250.0100.00816.50
7.3.240.0100.01016.40
7.3.230.0120.00416.45
7.3.210.0070.01016.30
7.3.200.0090.00719.39
7.3.190.0150.00616.26
7.3.180.0130.00316.60
7.3.170.0030.01316.40
7.3.160.0160.00016.37
7.3.10.0140.00516.51
7.3.00.0080.00716.36
7.2.330.0100.01316.54
7.2.320.0110.00916.79
7.2.310.0040.01516.80
7.2.300.0090.00916.74
7.2.290.0100.00716.65
7.2.130.0100.00516.58
7.2.120.0100.00516.65
7.2.110.0110.00716.32
7.2.100.0140.00516.65
7.2.90.0120.00916.75
7.2.80.0110.00616.76
7.2.70.0120.00416.50
7.2.60.0120.00816.83
7.2.50.0120.00516.76
7.2.40.0070.00916.58
7.2.30.0080.00816.45
7.2.20.0080.00816.62
7.2.10.0110.00816.73
7.2.00.0090.00616.67
7.1.250.0060.00815.33
7.1.240.0000.01315.49
7.1.230.0110.00815.56
7.1.220.0070.00715.32
7.1.210.0130.00915.00
7.1.200.0110.00515.66
7.1.190.0100.00015.41
7.1.180.0110.00415.50
7.1.170.0100.00015.39
7.1.160.0100.00715.33
7.1.150.0100.00615.48
7.1.140.0070.01015.70
7.1.130.0180.00015.25
7.1.120.0110.00815.48
7.1.110.0080.00615.65
7.1.100.0090.01215.56
7.1.90.0130.00015.69
7.1.80.0110.00415.45
7.1.70.0100.00216.39
7.1.60.0050.00917.45
7.1.50.0080.00616.11
7.1.40.0160.00315.45
7.1.30.0140.00415.64
7.1.20.0070.00715.44
7.1.10.0070.00715.67
7.1.00.0030.04318.96
7.0.330.0080.00815.04
7.0.320.0100.00715.30
7.0.310.0030.01014.93
7.0.300.0090.00615.16
7.0.290.0180.00015.29
7.0.280.0100.00715.20
7.0.270.0130.00315.21
7.0.260.0090.00615.03
7.0.250.0100.00615.34
7.0.240.0140.00715.15
7.0.230.0060.00915.27
7.0.220.0070.01115.17
7.0.210.0080.00815.20
7.0.200.0070.01015.87
7.0.190.0100.00314.99
7.0.180.0120.00815.00
7.0.170.0120.00315.09
7.0.160.0110.00415.29
7.0.150.0070.00715.25
7.0.140.0040.04418.64
7.0.130.0070.01415.14
7.0.120.0070.01115.07
7.0.110.0100.00315.28
7.0.100.0120.04517.58
7.0.90.0130.04617.61
7.0.80.0150.04417.69
7.0.70.0110.04317.59
7.0.60.0100.03017.54
7.0.50.0200.04017.92
7.0.40.0130.04116.71
7.0.30.0080.02916.78
7.0.20.0090.04416.71
7.0.10.0050.04916.71
7.0.00.0060.04616.68
5.6.380.0040.00714.13
5.6.370.0100.00514.08
5.6.360.0080.01414.29
5.6.350.0070.01514.47
5.6.340.0050.01513.97
5.6.330.0120.01114.52
5.6.320.0140.00814.21
5.6.310.0080.01414.27
5.6.300.0100.01614.14
5.6.290.0090.01214.59
5.6.280.0110.03517.56
5.6.270.0080.01214.01
5.6.260.0060.01214.04
5.6.250.0140.03617.37
5.6.240.0080.02917.41
5.6.230.0140.04217.31
5.6.220.0090.04917.38
5.6.210.0080.04017.69
5.6.200.0090.04817.69
5.6.190.0160.04317.71
5.6.180.0090.04517.59
5.6.170.0090.04317.78
5.6.160.0140.03917.55
5.6.150.0090.04517.64
5.6.140.0100.04417.65
5.6.130.0000.05817.66
5.6.120.0090.04417.52
5.6.110.0080.04817.70
5.6.100.0130.04017.53
5.6.90.0030.05017.47
5.6.80.0130.04117.21
5.6.70.0030.04517.13
5.6.60.0110.04017.12
5.6.50.0100.04017.09
5.6.40.0060.04417.33
5.6.30.0030.04917.07
5.6.20.0070.03717.18
5.6.10.0060.02817.18
5.6.00.0110.02317.08
5.5.380.0060.02515.72
5.5.370.0050.04315.77
5.5.360.0050.03215.79
5.5.350.0090.04415.79
5.5.340.0130.04115.88
5.5.330.0030.04316.03
5.5.320.0020.05016.02
5.5.310.0090.02615.95
5.5.300.0050.04315.97
5.5.290.0150.03815.93
5.5.280.0080.03915.74
5.5.270.0080.04315.99
5.5.260.0080.03115.86
5.5.250.0030.03915.80
5.5.240.0030.04415.60
5.5.230.0100.03815.79
5.5.220.0070.02515.67
5.5.210.0080.03815.54
5.5.200.0090.04115.59
5.5.190.0100.04115.45
5.5.180.0070.04015.44
5.5.170.0070.00711.03
5.5.160.0060.04315.54
5.5.150.0060.02715.56
5.5.140.0010.04415.56
5.5.130.0050.04515.47
5.5.120.0050.04315.46
5.5.110.0040.04615.70
5.5.100.0050.04315.44
5.5.90.0100.03815.73
5.5.80.0090.03715.40
5.5.70.0050.03415.49
5.5.60.0100.03715.54
5.5.50.0100.03715.54
5.5.40.0050.04015.64
5.5.30.0080.03815.72
5.5.20.0050.03215.55
5.5.10.0080.03715.52
5.5.00.0100.02215.29
5.4.450.0030.04715.26
5.4.440.0030.04915.35
5.4.430.0120.04115.40
5.4.420.0070.04615.20
5.4.410.0110.02515.13
5.4.400.0080.04615.17
5.4.390.0070.02915.00
5.4.380.0100.04015.06
5.4.370.0110.03315.02
5.4.360.0090.03914.98
5.4.350.0070.04215.13
5.4.340.0180.02815.15
5.4.330.0110.00611.40
5.4.320.0080.03514.89
5.4.310.0070.03915.02
5.4.300.0060.04114.98
5.4.290.0020.03914.97
5.4.280.0100.04014.97
5.4.270.0060.04514.88
5.4.260.0070.04314.94
5.4.250.0150.03515.07
5.4.240.0040.02815.28
5.4.230.0090.03415.08
5.4.220.0070.04114.85
5.4.210.0070.04315.06
5.4.200.0110.03915.18
5.4.190.0080.04014.96
5.4.180.0090.02115.22
5.4.170.0050.03514.94
5.4.160.0140.03315.03
5.4.150.0120.03314.89
5.4.140.0070.04113.80
5.4.130.0050.04113.62
5.4.120.0060.04113.68
5.4.110.0060.03613.80
5.4.100.0130.03513.85
5.4.90.0040.04013.80
5.4.80.0070.04113.79
5.4.70.0120.03613.82
5.4.60.0080.03513.75
5.4.50.0060.03013.62
5.4.40.0030.04413.51
5.4.30.0070.02713.70
5.4.20.0130.02513.63
5.4.10.0080.03513.64
5.4.00.0110.03513.35
5.3.290.0050.03512.79
5.3.280.0040.02412.45
5.3.270.0060.02412.60
5.3.260.0080.04012.71
5.3.250.0030.02912.74
5.3.240.0030.04112.56
5.3.230.0050.04212.54
5.3.220.0100.03512.52
5.3.210.0070.02812.37
5.3.200.0110.01712.48
5.3.190.0070.03312.57
5.3.180.0060.04112.58
5.3.170.0060.03312.67
5.3.160.0140.03612.53
5.3.150.0050.04012.65
5.3.140.0120.02412.58
5.3.130.0050.03712.65
5.3.120.0060.04012.57
5.3.110.0070.03612.54
5.3.100.0080.03512.32
5.3.90.0060.02612.33
5.3.80.0050.03412.23
5.3.70.0000.04112.27
5.3.60.0060.03612.33
5.3.50.0050.02112.22
5.3.40.0050.03812.35
5.3.30.0050.02812.28
5.3.20.0120.03512.17
5.3.10.0070.03511.96
5.3.00.0100.03511.93
5.2.170.0030.03410.38
5.2.160.0120.02010.38
5.2.150.0070.03310.32
5.2.140.0050.02810.36
5.2.130.0060.03310.35
5.2.120.0050.02410.26
5.2.110.0080.03010.33
5.2.100.0050.03010.30
5.2.90.0070.03210.30
5.2.80.0020.03910.30
5.2.70.0050.03310.23
5.2.60.0050.03510.22
5.2.50.0040.03510.18
5.2.40.0040.03510.15
5.2.30.0030.02210.19
5.2.20.0050.02810.10
5.2.10.0060.02910.04
5.2.00.0000.0329.97
5.1.60.0020.0179.07
5.1.50.0060.0259.28
5.1.40.0020.0319.24
5.1.30.0050.0309.44
5.1.20.0060.0289.47
5.1.10.0030.0319.35
5.1.00.0050.0299.40
5.0.50.0000.0178.61
5.0.40.0030.0168.61
5.0.30.0020.0328.61
5.0.20.0000.0268.61
5.0.10.0030.0228.61
5.0.00.0050.0348.61
4.4.90.0020.0198.61
4.4.80.0020.0188.61
4.4.70.0050.0178.61
4.4.60.0020.0208.61
4.4.50.0030.0168.61
4.4.40.0070.0258.61
4.4.30.0000.0218.61
4.4.20.0050.0198.61
4.4.10.0020.0208.61
4.4.00.0020.0288.61
4.3.110.0030.0188.61
4.3.100.0020.0128.61
4.3.90.0000.0138.61
4.3.80.0020.0288.61
4.3.70.0040.0198.61
4.3.60.0030.0108.61
4.3.50.0020.0208.61
4.3.40.0020.0288.61
4.3.30.0020.0188.61
4.3.20.0020.0208.61
4.3.10.0000.0228.61
4.3.00.0000.0228.61

preferences:
87.39 ms | 401 KiB | 5 Q