3v4l.org

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

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.0100.01016.63
8.3.50.0110.00721.92
8.3.40.0060.00918.63
8.3.30.0110.00718.71
8.3.20.0040.00420.33
8.3.10.0080.00023.66
8.3.00.0040.00419.25
8.2.180.0110.00418.66
8.2.170.0070.00722.96
8.2.160.0040.01122.19
8.2.150.0050.00325.66
8.2.140.0000.00824.66
8.2.130.0100.00026.16
8.2.120.0040.00417.63
8.2.110.0040.00419.27
8.2.100.0090.00318.03
8.2.90.0000.00819.23
8.2.80.0000.00817.97
8.2.70.0040.00417.38
8.2.60.0100.00017.80
8.2.50.0050.00518.07
8.2.40.0000.00919.28
8.2.30.0040.00420.61
8.2.20.0040.00417.77
8.2.10.0040.00417.93
8.2.00.0040.00418.11
8.1.280.0100.01025.92
8.1.270.0080.00023.89
8.1.260.0040.00426.35
8.1.250.0040.00428.09
8.1.240.0030.00620.97
8.1.230.0040.00717.51
8.1.220.0000.00817.74
8.1.210.0040.00418.77
8.1.200.0090.00017.23
8.1.190.0070.00017.22
8.1.180.0000.00718.10
8.1.170.0040.00418.59
8.1.160.0000.00722.04
8.1.150.0000.00718.75
8.1.140.0040.00419.51
8.1.130.0040.00417.69
8.1.120.0070.00017.48
8.1.110.0000.00817.41
8.1.100.0040.00417.32
8.1.90.0000.00717.42
8.1.80.0100.00017.44
8.1.70.0000.00717.38
8.1.60.0040.00417.55
8.1.50.0060.00317.39
8.1.40.0000.00817.50
8.1.30.0000.00817.62
8.1.20.0090.00017.43
8.1.10.0040.00417.38
8.1.00.0040.00417.52
8.0.300.0070.00318.77
8.0.290.0000.00716.71
8.0.280.0030.00318.58
8.0.270.0030.00617.32
8.0.260.0000.00617.37
8.0.250.0060.00317.00
8.0.240.0040.00416.95
8.0.230.0000.00716.99
8.0.220.0050.00316.93
8.0.210.0070.00016.98
8.0.200.0030.00516.96
8.0.190.0040.00417.08
8.0.180.0040.00417.00
8.0.170.0040.00417.04
8.0.160.0050.00316.87
8.0.150.0000.00716.91
8.0.140.0000.00716.88
8.0.130.0070.00013.41
8.0.120.0080.00016.91
8.0.110.0000.00816.98
8.0.100.0040.00416.74
8.0.90.0000.00816.97
8.0.80.0030.01216.92
8.0.70.0000.00716.98
8.0.60.0040.00416.83
8.0.50.0040.00416.98
8.0.30.0090.00916.93
8.0.20.0130.00517.40
8.0.10.0070.00017.01
8.0.00.0110.00816.77
7.4.330.0000.00515.08
7.4.320.0000.00616.39
7.4.300.0000.00716.46
7.4.290.0040.00416.60
7.4.280.0060.00316.52
7.4.270.0070.00016.38
7.4.260.0000.00716.57
7.4.250.0040.00416.42
7.4.240.0020.00516.48
7.4.230.0000.00716.38
7.4.220.0070.01016.50
7.4.210.0090.00616.49
7.4.200.0070.00016.57
7.4.160.0130.00316.46
7.4.150.0120.00417.40
7.4.140.0080.01017.86
7.4.130.0090.01116.42
7.4.120.0120.00516.58
7.4.110.0090.00916.60
7.4.100.0090.00916.54
7.4.90.0140.00316.46
7.4.80.0070.01019.39
7.4.70.0030.01616.40
7.4.60.0030.01416.60
7.4.50.0050.00316.66
7.4.40.0090.01216.37
7.4.30.0070.01016.36
7.4.00.0070.00714.98
7.3.330.0020.00213.14
7.3.320.0030.00313.17
7.3.310.0030.00316.32
7.3.300.0030.00316.23
7.3.290.0060.01016.23
7.3.280.0100.00916.30
7.3.270.0060.01817.40
7.3.260.0060.01016.29
7.3.250.0080.00916.35
7.3.240.0120.00716.51
7.3.230.0090.00916.45
7.3.210.0130.00316.34
7.3.200.0080.01316.42
7.3.190.0110.00516.30
7.3.180.0090.00616.47
7.3.170.0100.00716.61
7.3.160.0000.01616.26
7.3.120.0110.00314.71
7.3.110.0070.01114.88
7.3.100.0070.00714.73
7.3.90.0000.01715.00
7.3.80.0030.01514.48
7.3.70.0070.00714.40
7.3.60.0040.01114.84
7.3.50.0070.00714.57
7.3.40.0070.01114.92
7.3.30.0110.00414.41
7.3.20.0110.00616.59
7.3.10.0120.00316.55
7.3.00.0060.00616.51
7.2.330.0120.00616.45
7.2.320.0060.01616.58
7.2.310.0090.00916.28
7.2.300.0110.00916.55
7.2.290.0100.00616.64
7.2.240.0030.00914.61
7.2.230.0120.00615.15
7.2.220.0070.00714.81
7.2.210.0060.01214.71
7.2.200.0000.01414.95
7.2.190.0040.01414.61
7.2.180.0100.00314.83
7.2.170.0030.01014.88
7.2.160.0080.00814.84
7.2.150.0070.01116.77
7.2.140.0090.00616.70
7.2.130.0130.00316.60
7.2.120.0000.01816.56
7.2.110.0090.00616.69
7.2.100.0120.00616.65
7.2.90.0030.00916.73
7.2.80.0030.01216.79
7.2.70.0110.00716.90
7.2.60.0060.00816.48
7.2.50.0030.00916.71
7.2.40.0070.01016.86
7.2.30.0000.01216.44
7.2.20.0100.00616.74
7.2.10.0110.00716.83
7.2.00.0110.00317.79
7.1.330.0030.01215.89
7.1.320.0040.00715.69
7.1.310.0000.01815.74
7.1.300.0060.00915.74
7.1.290.0100.00315.71
7.1.280.0070.01015.75
7.1.270.0030.01015.73
7.1.260.0000.01715.87
7.1.250.0030.01515.83
7.1.200.0000.01415.71
7.1.100.0100.00318.12
7.1.70.0040.00416.79
7.1.60.0100.01619.43
7.1.50.0070.01116.80
7.1.00.0000.08022.48
7.0.200.0290.00414.54
7.0.60.0070.08319.93
7.0.50.0100.07717.89
7.0.40.0030.04320.21
7.0.30.0270.03720.30
7.0.20.0170.09020.30
7.0.10.0070.08020.24
7.0.00.0130.06020.31
5.6.280.0000.05721.09
5.6.210.0130.07720.51
5.6.200.0000.08718.27
5.6.190.0130.06320.46
5.6.180.0470.04320.61
5.6.170.0130.04720.60
5.6.160.0130.07020.55
5.6.150.0070.08018.17
5.6.140.0130.03018.18
5.6.130.0070.07718.18
5.6.120.0130.07320.91
5.6.110.0170.07320.89
5.6.100.0130.07321.00
5.6.90.0030.09321.13
5.6.80.0100.03320.27
5.5.350.0330.07720.43
5.5.340.0100.07717.94
5.5.330.0070.08020.42
5.5.320.0270.06720.33
5.5.310.0200.04320.41
5.5.300.0030.05017.95
5.5.290.0070.04317.95
5.5.280.0070.04020.66
5.5.270.0070.08720.74
5.5.260.0030.06020.77
5.5.250.0030.05720.63
5.5.240.0000.04720.17
5.4.450.0170.05719.45
5.4.440.0130.06019.60
5.4.430.0200.05319.25
5.4.420.0100.07019.45
5.4.410.0200.04719.14
5.4.400.0200.05019.20
5.4.390.0170.07319.29
5.4.380.0130.05319.22
5.4.370.0070.06019.11
5.4.360.0270.04319.19
5.4.350.0100.05719.27
5.4.340.0100.06018.81
5.4.320.0130.06019.13
5.4.310.0100.05318.87
5.4.300.0130.05319.11
5.4.290.0230.04318.92
5.4.280.0300.04019.27
5.4.270.0200.04718.82
5.4.260.0270.05018.96
5.4.250.0130.05319.13
5.4.240.0170.05018.95
5.4.230.0100.06018.80
5.4.220.0200.05319.13
5.4.210.0130.05719.12
5.4.200.0100.06319.27
5.4.190.0230.05719.10
5.4.180.0200.06019.10
5.4.170.0300.06319.15
5.4.160.0300.05319.09
5.4.150.0270.04718.93
5.4.140.0100.08016.53
5.4.130.0300.03716.61
5.4.120.0170.05716.48
5.4.110.0300.06016.50
5.4.100.0230.05016.25
5.4.90.0130.06016.50
5.4.80.0200.06316.63
5.4.70.0230.05316.52
5.4.60.0130.07016.54
5.4.50.0070.05716.55
5.4.40.0130.05716.47
5.4.30.0230.04316.54
5.4.20.0200.05016.48
5.4.10.0270.05716.47
5.4.00.0230.05715.85

preferences:
60.13 ms | 401 KiB | 5 Q