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'; } $message = $shape->render(); return $message; } } 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.0120.00316.63
8.3.50.0100.01021.92
8.3.40.0090.00918.79
8.3.30.0110.00318.71
8.3.20.0000.00820.14
8.3.10.0040.00423.48
8.3.00.0000.00919.38
8.2.180.0120.00918.41
8.2.170.0110.00722.96
8.2.160.0100.00322.13
8.2.150.0030.00624.18
8.2.140.0040.00424.66
8.2.130.0040.00426.16
8.2.120.0040.00417.59
8.2.110.0090.00020.18
8.2.100.0120.00018.04
8.2.90.0040.00419.22
8.2.80.0040.00417.97
8.2.70.0040.00417.63
8.2.60.0070.00317.91
8.2.50.0040.00418.07
8.2.40.0000.00719.31
8.2.30.0070.00020.59
8.2.20.0080.00017.69
8.2.10.0000.00718.13
8.2.00.0050.00318.14
8.1.280.0070.00725.92
8.1.270.0060.00323.82
8.1.260.0040.00426.35
8.1.250.0040.00428.09
8.1.240.0030.00920.73
8.1.230.0030.00917.65
8.1.220.0030.00617.79
8.1.210.0000.00918.77
8.1.200.0060.00317.35
8.1.190.0040.00417.35
8.1.180.0040.00418.10
8.1.170.0080.00018.59
8.1.160.0080.00021.99
8.1.150.0000.00718.95
8.1.140.0000.00819.59
8.1.130.0030.00317.74
8.1.120.0030.00317.49
8.1.110.0050.00317.51
8.1.100.0040.00417.41
8.1.90.0000.00717.46
8.1.80.0030.00617.48
8.1.70.0000.00717.46
8.1.60.0030.00517.65
8.1.50.0040.00417.46
8.1.40.0060.00317.57
8.1.30.0030.00517.70
8.1.20.0050.00217.61
8.1.10.0030.00617.43
8.1.00.0050.00317.38
8.0.300.0040.00418.77
8.0.290.0000.00716.63
8.0.280.0070.00018.52
8.0.270.0050.00317.28
8.0.260.0040.00417.34
8.0.250.0040.00417.04
8.0.240.0000.00917.07
8.0.230.0030.00317.04
8.0.220.0050.00216.99
8.0.210.0030.00316.87
8.0.200.0030.00317.05
8.0.190.0050.00317.08
8.0.180.0000.00716.89
8.0.170.0060.00317.02
8.0.160.0040.00417.00
8.0.150.0000.00716.95
8.0.140.0030.00316.89
8.0.130.0000.00713.45
8.0.120.0000.00816.95
8.0.110.0050.00216.91
8.0.100.0000.00816.86
8.0.90.0040.00317.00
8.0.80.0040.01117.02
8.0.70.0000.00816.94
8.0.60.0000.00816.89
8.0.50.0000.00717.00
8.0.30.0140.00817.19
8.0.20.0100.00817.40
8.0.10.0020.00516.97
8.0.00.0080.01016.70
7.4.330.0000.00615.09
7.4.320.0030.00316.55
7.4.300.0070.00016.63
7.4.290.0000.00616.55
7.4.280.0080.00016.66
7.4.270.0030.00316.49
7.4.260.0070.00016.50
7.4.250.0000.00716.50
7.4.240.0030.00316.59
7.4.230.0030.00316.50
7.4.220.0200.00316.48
7.4.210.0040.01216.45
7.4.200.0020.00516.52
7.4.160.0060.01016.54
7.4.150.0110.00717.40
7.4.140.0140.00417.86
7.4.130.0060.01216.53
7.4.120.0050.01116.53
7.4.110.0060.01216.58
7.4.100.0090.01316.46
7.4.90.0030.01316.57
7.4.80.0140.00719.39
7.4.70.0100.00716.71
7.4.60.0080.00916.69
7.4.50.0000.00816.57
7.4.40.0110.00716.47
7.4.30.0060.01616.69
7.4.00.0100.00714.77
7.3.330.0020.00213.38
7.3.320.0000.00513.13
7.3.310.0000.00716.12
7.3.300.0000.00716.21
7.3.290.0060.00916.29
7.3.280.0050.01316.28
7.3.270.0070.01117.40
7.3.260.0060.01216.37
7.3.250.0080.00916.43
7.3.240.0090.01016.41
7.3.230.0140.00616.39
7.3.210.0030.01316.60
7.3.200.0130.00316.38
7.3.190.0030.01316.49
7.3.180.0100.00716.32
7.3.170.0100.00716.33
7.3.160.0120.00316.48
7.3.10.0050.00516.45
7.3.00.0100.00516.39
7.2.330.0170.00316.65
7.2.320.0060.01416.78
7.2.310.0090.00916.59
7.2.300.0120.00916.52
7.2.290.0080.00816.63
7.2.130.0090.00316.90
7.2.120.0040.00616.72
7.2.110.0040.00816.86
7.2.100.0060.00716.82
7.2.90.0060.00616.78
7.2.80.0080.00516.72
7.2.70.0100.00616.96
7.2.60.0050.00816.79
7.2.50.0090.00416.83
7.2.40.0060.01217.06
7.2.30.0130.00516.80
7.2.20.0050.01016.88
7.2.10.0150.00716.82
7.2.00.0050.01117.48
7.1.250.0030.00815.70
7.1.200.0060.00315.59
7.1.100.0030.00718.24
7.1.70.0030.00616.93
7.1.60.0110.01419.43
7.1.50.0030.00716.96
7.1.00.0070.07322.53
7.0.200.0590.01014.64
7.0.60.0030.06319.90
7.0.50.0130.08017.89
7.0.40.0070.05720.18
7.0.30.0230.04320.21
7.0.20.0330.07320.19
7.0.10.0030.09020.06
7.0.00.0030.04320.20
5.6.280.0030.04721.09
5.6.210.0000.08720.52
5.6.200.0030.05318.20
5.6.190.0100.05320.77
5.6.180.0400.04720.79
5.6.170.0230.03720.46
5.6.160.0030.07320.50
5.6.150.0000.05018.25
5.6.140.0030.03718.18
5.6.130.0100.07718.28
5.6.120.0030.07721.00
5.6.110.0100.06720.98
5.6.100.0100.06721.15
5.6.90.0170.06020.97
5.6.80.0070.04320.54
5.5.350.0300.07020.44
5.5.340.0030.07717.95
5.5.330.0070.08320.56
5.5.320.0270.07320.20
5.5.310.0270.07720.35
5.5.300.0000.07017.97
5.5.290.0030.04318.08
5.5.280.0130.05020.66
5.5.270.0030.04720.77
5.5.260.0130.06320.65
5.5.250.0100.08020.59
5.5.240.0070.07320.05
5.4.450.0570.04319.20
5.4.440.0470.06019.13
5.4.430.0470.05319.45
5.4.420.0530.05719.45
5.4.410.0500.05019.13
5.4.400.0500.04719.20
5.4.390.0700.05319.19
5.4.380.0500.04718.86
5.4.370.0430.05718.96
5.4.360.0700.06318.96
5.4.350.0570.05319.27
5.4.340.0470.06019.19
5.4.320.0570.05718.97
5.4.310.0700.03719.11
5.4.300.0500.04719.14
5.4.290.0500.05718.97
5.4.280.0600.05019.11
5.4.270.0370.05319.11
5.4.260.0500.04319.15
5.4.250.0430.05018.95
5.4.240.0600.05019.13
5.4.230.0430.05318.92
5.4.220.0230.06318.86
5.4.210.0000.06019.13
5.4.200.0200.05019.11
5.4.190.0400.05718.96
5.4.180.0400.05718.96
5.4.170.0430.05318.80
5.4.160.0470.05019.11
5.4.150.0570.06719.11
5.4.140.0370.05716.33
5.4.130.0570.05316.39
5.4.120.0470.05316.39
5.4.110.0500.05316.57
5.4.100.0570.04716.59
5.4.90.0500.05016.62
5.4.80.0370.05716.37
5.4.70.0370.05316.58
5.4.60.0600.04016.45
5.4.50.0570.04316.58
5.4.40.0630.04316.47
5.4.30.0530.05016.30
5.4.20.0730.06316.47
5.4.10.0700.07016.56
5.4.00.0570.07315.91

preferences:
61.72 ms | 401 KiB | 5 Q