3v4l.org

run code in 300+ PHP versions simultaneously
<?php class ShapeFactory { public function __construct($type) { $shape = null; switch ($type){ case 'rectangle': $shape = new RectangleShape; break; case 'square': $shape = new SquareShape; break; default: return 'No such file'; } print_r($shape); return $shape->render(); } } interface Shape { public function render(); } class SquareShape implements Shape { public $name = 'square'; public function render() { return $this->name; } } class RectangleShape implements Shape { public $name = 'rectangle'; public function render() { echo $this->name; return $this->name; } } $test = new ShapeFactory('rectangle'); echo $test;

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.0180.00416.62
8.3.50.0110.00922.11
8.3.40.0040.01118.79
8.3.30.0110.00418.70
8.3.20.0050.00320.34
8.3.10.0070.00723.66
8.3.00.0040.00419.23
8.2.180.0140.00317.00
8.2.170.0150.00022.96
8.2.160.0090.00522.15
8.2.150.0060.00324.18
8.2.140.0000.00824.66
8.2.130.0040.00426.16
8.2.120.0040.00417.63
8.2.110.0090.00020.61
8.2.100.0070.00417.78
8.2.90.0030.00619.26
8.2.80.0040.00417.97
8.2.70.0030.00617.63
8.2.60.0100.00217.80
8.2.50.0030.00618.07
8.2.40.0040.00419.33
8.2.30.0040.00420.55
8.2.20.0050.00317.78
8.2.10.0040.00418.01
8.2.00.0000.00718.16
8.1.280.0100.01025.92
8.1.270.0050.00323.97
8.1.260.0080.00026.35
8.1.250.0040.00428.09
8.1.240.0060.00321.93
8.1.230.0110.00023.96
8.1.220.0000.00917.74
8.1.210.0040.00418.77
8.1.200.0030.00617.47
8.1.190.0030.00517.36
8.1.180.0080.00018.10
8.1.170.0080.00018.59
8.1.160.0000.00721.99
8.1.150.0070.00018.76
8.1.140.0030.00519.57
8.1.130.0030.00317.63
8.1.120.0070.00017.48
8.1.110.0050.00317.37
8.1.100.0050.00217.39
8.1.90.0030.00317.48
8.1.80.0000.00717.46
8.1.70.0000.00717.34
8.1.60.0080.00017.64
8.1.50.0060.00317.57
8.1.40.0000.00817.48
8.1.30.0080.00017.71
8.1.20.0040.00417.57
8.1.10.0030.00517.59
8.1.00.0040.00417.38
8.0.300.0040.00418.77
8.0.290.0070.00016.75
8.0.280.0030.00318.41
8.0.270.0000.00817.32
8.0.260.0000.00817.26
8.0.250.0040.00417.05
8.0.240.0040.00416.93
8.0.230.0070.00017.03
8.0.220.0040.00417.00
8.0.210.0040.00416.96
8.0.200.0040.00417.05
8.0.190.0030.00516.96
8.0.180.0040.00416.88
8.0.170.0000.00817.01
8.0.160.0040.00416.96
8.0.150.0000.00716.86
8.0.140.0040.00416.94
8.0.130.0040.00413.44
8.0.120.0070.00016.92
8.0.110.0000.00716.82
8.0.100.0080.00017.01
8.0.90.0040.00417.08
8.0.80.0040.01117.00
8.0.70.0000.00716.91
8.0.60.0070.00016.84
8.0.50.0040.00416.97
8.0.30.0120.00617.15
8.0.20.0100.01017.40
8.0.10.0090.00017.16
8.0.00.0110.00616.95
7.4.330.0050.00015.09
7.4.320.0060.00016.51
7.4.300.0000.00616.59
7.4.290.0030.00316.53
7.4.280.0000.00716.36
7.4.270.0030.00316.59
7.4.260.0000.00716.52
7.4.250.0040.00416.63
7.4.240.0050.00216.61
7.4.230.0000.00816.69
7.4.220.0100.01016.55
7.4.210.0060.00916.57
7.4.200.0050.00216.68
7.4.160.0110.00516.31
7.4.150.0030.01517.40
7.4.140.0080.01517.86
7.4.130.0120.00816.43
7.4.120.0100.00816.62
7.4.110.0100.00716.60
7.4.100.0090.01216.58
7.4.90.0130.01016.41
7.4.80.0120.00819.39
7.4.70.0060.01016.47
7.4.60.0030.01516.67
7.4.50.0000.00816.57
7.4.40.0140.00316.54
7.4.30.0030.01816.41
7.4.00.0060.01214.79
7.3.330.0000.00513.28
7.3.320.0030.00313.20
7.3.310.0030.00316.32
7.3.300.0040.00416.30
7.3.290.0090.00616.28
7.3.280.0100.00616.30
7.3.270.0120.00917.40
7.3.260.0110.01316.25
7.3.250.0070.01016.38
7.3.240.0150.00516.54
7.3.230.0070.01516.50
7.3.210.0090.00916.63
7.3.200.0090.00916.41
7.3.190.0090.01216.39
7.3.180.0130.00716.33
7.3.170.0120.00916.43
7.3.160.0090.00616.24
7.3.120.0060.01014.86
7.3.110.0030.01515.02
7.3.100.0040.00814.86
7.3.90.0090.00614.45
7.3.80.0000.01414.83
7.3.70.0030.01014.70
7.3.60.0070.00714.65
7.3.50.0030.01314.64
7.3.40.0060.00914.83
7.3.30.0070.00714.84
7.3.20.0070.01016.73
7.3.10.0040.00816.74
7.3.00.0000.00916.79
7.2.330.0160.00716.78
7.2.320.0090.00916.77
7.2.310.0130.00316.31
7.2.300.0110.00716.46
7.2.290.0040.01216.75
7.2.240.0030.00815.09
7.2.230.0000.01314.88
7.2.220.0100.00615.25
7.2.210.0090.00615.25
7.2.200.0100.00314.97
7.2.190.0030.01415.02
7.2.180.0000.01814.79
7.2.170.0060.00615.04
7.2.160.0130.00615.18
7.2.150.0100.00316.85
7.2.140.0130.00016.80
7.2.130.0030.01017.06
7.2.120.0060.00916.96
7.2.110.0100.00616.84
7.2.100.0060.00316.80
7.2.90.0060.01016.97
7.2.80.0030.01017.11
7.2.70.0030.01316.92
7.2.60.0050.00816.90
7.2.50.0060.00916.70
7.2.40.0070.00717.15
7.2.30.0000.01116.95
7.2.20.0120.00317.11
7.2.10.0080.00816.87
7.2.00.0050.01218.00
7.1.330.0000.01315.96
7.1.320.0070.00316.06
7.1.310.0060.00915.49
7.1.300.0030.00915.77
7.1.290.0080.00415.80
7.1.280.0030.01215.64
7.1.270.0060.00615.85
7.1.260.0130.00315.87
7.1.250.0030.00715.75
7.1.200.0040.00715.72
7.1.100.0000.01118.28
7.1.70.0000.00717.19
7.1.60.0130.01319.43
7.1.50.0000.01016.96
7.1.00.0070.07322.41
7.0.200.0810.00614.84
7.0.60.0030.08719.97
7.0.50.0070.04717.99
7.0.40.0100.04020.09
7.0.30.0270.06320.27
7.0.20.0300.07720.26
7.0.10.0100.04020.06
7.0.00.0070.04020.10
5.6.280.0070.03021.08
5.6.210.0170.07020.62
5.6.200.0070.04318.24
5.6.190.0030.04320.68
5.6.180.0530.07020.51
5.6.170.0230.03720.46
5.6.160.0030.07720.71
5.6.150.0130.07318.17
5.6.140.0100.03018.15
5.6.130.0030.06018.20
5.6.120.0070.05320.95
5.6.110.0030.08020.97
5.6.100.0170.04720.89
5.6.90.0100.05021.11
5.6.80.0030.04020.38
5.5.350.0400.05020.51
5.5.340.0070.08018.09
5.5.330.0200.08020.57
5.5.320.0330.07320.38
5.5.310.0200.05720.38
5.5.300.0070.06017.97
5.5.290.0100.07317.94
5.5.280.0100.08720.76
5.5.270.0100.06720.69
5.5.260.0030.06020.89
5.5.250.0130.05320.63
5.5.240.0000.08720.28
5.4.450.0500.08019.52
5.4.440.0630.07019.44
5.4.430.0300.07719.18
5.4.420.0170.07019.29
5.4.410.0200.05719.12
5.4.400.0630.06719.23
5.4.390.0670.06719.12
5.4.380.0130.05719.11
5.4.370.0100.06318.97
5.4.360.0470.06719.19
5.4.350.0500.05719.11
5.4.340.0670.05718.88
5.4.320.0630.06018.81
5.4.310.0700.06318.86
5.4.300.0670.05319.11
5.4.290.0700.05718.92
5.4.280.0600.06018.92
5.4.270.0530.06319.13
5.4.260.0630.05718.86
5.4.250.0600.05718.80
5.4.240.0970.05719.12
5.4.230.0830.04719.26
5.4.220.0830.06319.18
5.4.210.0870.05718.97
5.4.200.0570.06718.88
5.4.190.0730.07019.27
5.4.180.0500.07019.10
5.4.170.0730.07719.26
5.4.160.0700.04719.14
5.4.150.0500.07018.90
5.4.140.0770.05316.37
5.4.130.0600.04716.45
5.4.120.0530.05316.57
5.4.110.0430.06016.64
5.4.100.0670.04716.54
5.4.90.0870.06316.25
5.4.80.0600.06716.54
5.4.70.0670.06016.51
5.4.60.0630.06316.14
5.4.50.0670.07016.55
5.4.40.0870.05016.61
5.4.30.0700.05316.48
5.4.20.0670.04316.13
5.4.10.0600.05016.38
5.4.00.0570.05316.04

preferences:
52.6 ms | 401 KiB | 5 Q