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: echo 'No such file'; } $message = $shape->render(); echo $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.0070.01416.63
8.3.50.0130.00622.11
8.3.40.0150.00318.83
8.3.30.0100.00318.87
8.3.20.0070.00020.38
8.3.10.0020.00523.53
8.3.00.0080.00019.38
8.2.180.0110.00716.61
8.2.170.0150.00022.96
8.2.160.0100.00322.13
8.2.150.0080.00024.18
8.2.140.0050.00324.66
8.2.130.0070.00026.16
8.2.120.0040.00417.50
8.2.110.0080.00320.90
8.2.100.0080.00417.90
8.2.90.0050.00319.05
8.2.80.0040.00417.97
8.2.70.0000.00817.50
8.2.60.0030.00918.04
8.2.50.0030.00618.07
8.2.40.0000.00719.34
8.2.30.0000.00720.55
8.2.20.0040.00417.73
8.2.10.0030.00518.20
8.2.00.0050.00318.13
8.1.280.0190.00325.92
8.1.270.0090.00023.91
8.1.260.0040.00426.35
8.1.250.0000.00728.09
8.1.240.0060.00320.95
8.1.230.0070.00417.45
8.1.220.0000.00817.74
8.1.210.0030.00618.77
8.1.200.0070.00317.35
8.1.190.0000.00917.23
8.1.180.0060.00318.10
8.1.170.0050.00518.71
8.1.160.0000.00722.07
8.1.150.0040.00418.96
8.1.140.0040.00419.59
8.1.130.0070.00017.72
8.1.120.0040.00417.39
8.1.110.0040.00417.42
8.1.100.0070.00017.34
8.1.90.0040.00417.44
8.1.80.0000.00817.50
8.1.70.0040.00417.38
8.1.60.0000.00717.57
8.1.50.0060.00317.43
8.1.40.0030.00617.57
8.1.30.0030.00617.74
8.1.20.0040.00417.56
8.1.10.0000.00817.48
8.1.00.0020.00517.45
8.0.300.0050.00218.77
8.0.290.0080.00016.63
8.0.280.0030.00318.38
8.0.270.0030.00617.29
8.0.260.0030.00317.35
8.0.250.0000.00717.04
8.0.240.0040.00417.06
8.0.230.0000.00617.01
8.0.220.0000.00717.01
8.0.210.0000.00716.89
8.0.200.0000.00617.05
8.0.190.0040.00417.03
8.0.180.0070.00016.96
8.0.170.0000.00816.98
8.0.160.0030.00516.93
8.0.150.0070.00016.92
8.0.140.0000.00716.96
8.0.130.0050.00313.36
8.0.120.0060.00316.92
8.0.110.0040.00416.88
8.0.100.0000.00816.77
8.0.90.0030.00317.10
8.0.80.0090.00517.04
8.0.70.0030.00516.89
8.0.60.0000.00717.05
8.0.50.0000.00716.84
8.0.30.0060.01017.28
8.0.20.0080.01017.40
8.0.10.0040.00416.99
8.0.00.0080.01216.82
7.4.330.0000.00515.09
7.4.320.0030.00316.64
7.4.300.0000.00616.53
7.4.290.0040.00416.53
7.4.280.0040.00416.43
7.4.270.0030.00316.51
7.4.260.0030.00316.46
7.4.250.0040.00416.34
7.4.240.0010.00616.55
7.4.230.0050.00216.42
7.4.220.0090.00916.45
7.4.210.0070.01416.72
7.4.200.0000.00716.71
7.4.160.0080.00816.41
7.4.150.0110.00617.40
7.4.140.0080.01317.86
7.4.130.0080.00916.45
7.4.120.0090.01116.53
7.4.110.0110.00616.39
7.4.100.0030.01616.58
7.4.90.0150.00316.46
7.4.80.0160.00619.39
7.4.70.0030.01216.62
7.4.60.0070.01516.64
7.4.50.0000.00816.41
7.4.40.0100.01016.55
7.4.30.0160.00616.61
7.4.00.0060.01215.00
7.3.330.0000.00513.23
7.3.320.0000.00613.23
7.3.310.0070.00016.38
7.3.300.0030.00316.32
7.3.290.0070.00616.31
7.3.280.0120.00816.29
7.3.270.0130.00617.40
7.3.260.0140.00816.21
7.3.250.0100.00916.33
7.3.240.0070.01216.45
7.3.230.0060.01116.39
7.3.210.0100.00716.34
7.3.200.0070.01016.44
7.3.190.0150.00616.43
7.3.180.0100.00716.29
7.3.170.0060.01016.41
7.3.160.0000.01516.41
7.3.120.0070.01014.75
7.3.110.0100.00614.96
7.3.100.0050.00914.70
7.3.90.0050.00814.62
7.3.80.0020.01014.71
7.3.70.0050.00914.72
7.3.60.0070.00814.90
7.3.50.0060.00514.63
7.3.40.0110.00514.81
7.3.30.0040.00814.86
7.3.20.0100.00416.60
7.3.10.0070.00716.68
7.3.00.0050.00716.65
7.2.330.0060.01216.39
7.2.320.0030.00516.28
7.2.310.0120.00616.84
7.2.300.0040.01316.84
7.2.290.0160.00616.77
7.2.250.0100.00615.09
7.2.240.0110.00715.02
7.2.230.0080.00615.04
7.2.220.0040.01015.05
7.2.210.0060.00715.08
7.2.200.0090.00214.83
7.2.190.0030.00914.91
7.2.180.0050.00914.93
7.2.170.0090.00615.04
7.2.60.0040.00816.47
7.2.00.0070.00718.54
7.1.330.0040.00915.79
7.1.320.0010.01015.67
7.1.310.0030.01015.66
7.1.300.0040.00615.77
7.1.290.0050.00915.77
7.1.280.0100.00415.68
7.1.270.0060.00715.71
7.1.260.0070.00415.77
7.1.200.0070.00715.88
7.1.100.0060.00618.02
7.1.70.0050.00316.85
7.1.60.0110.01419.43
7.1.50.0070.01017.05
7.1.00.0070.07322.32
7.0.200.0730.00714.64
7.0.60.0100.05020.04
7.0.50.0030.08017.88
7.0.40.0170.08020.23
7.0.30.0170.05720.13
7.0.20.0270.08020.05
7.0.10.0100.08020.15
7.0.00.0070.05020.10
5.6.280.0130.04721.04
5.6.210.0030.08320.72
5.6.200.0030.04318.18
5.6.190.0000.04720.55
5.6.180.0470.05720.48
5.6.170.0130.04720.62
5.6.160.0070.08020.46
5.6.150.0000.05018.19
5.6.140.0030.03718.28
5.6.130.0000.04318.18
5.6.120.0070.06721.13
5.6.110.0070.05321.00
5.6.100.0170.07021.08
5.6.90.0100.07720.99
5.6.80.0070.04020.43
5.5.350.0330.07020.36
5.5.340.0030.08318.08
5.5.330.0230.07020.31
5.5.320.0370.06320.38
5.5.310.0270.08020.35
5.5.300.0070.04318.00
5.5.290.0070.08717.94
5.5.280.0170.07720.67
5.5.270.0030.04320.98
5.5.260.0200.06320.88
5.5.250.0070.08320.79
5.5.240.0030.04320.05
5.4.450.0200.05719.43
5.4.440.0100.08319.43
5.4.430.0170.07019.51
5.4.420.0100.06019.52
5.4.410.0300.06719.36
5.4.400.0170.05319.29
5.4.390.0200.05319.11
5.4.380.0130.08018.81
5.4.370.0100.06018.96
5.4.360.0170.06719.16
5.4.350.0200.04719.13
5.4.340.0170.05018.97
5.4.320.0230.04719.28
5.4.310.0100.05719.16
5.4.300.0230.04719.14
5.4.290.0100.07319.27
5.4.280.0200.05019.27
5.4.270.0070.06018.93
5.4.260.0270.04018.89
5.4.250.0070.06019.11
5.4.240.0100.05319.27
5.4.230.0130.05319.18
5.4.220.0170.05019.18
5.4.210.0200.05019.18
5.4.200.0070.05719.10
5.4.190.0230.06718.95
5.4.180.0170.05018.92
5.4.170.0070.06018.95
5.4.160.0230.05718.95
5.4.150.0200.05319.08
5.4.140.0200.05016.37
5.4.130.0170.04316.54
5.4.120.0170.04716.42
5.4.110.0170.05716.55
5.4.100.0130.05016.56
5.4.90.0070.05316.55
5.4.80.0130.04716.55
5.4.70.0330.05016.60
5.4.60.0130.06716.22
5.4.50.0330.05016.60
5.4.40.0130.05016.45
5.4.30.0130.05016.38
5.4.20.0200.04316.55
5.4.10.0130.06316.45
5.4.00.0100.05315.82

preferences:
51.68 ms | 401 KiB | 5 Q