3v4l.org

run code in 300+ PHP versions simultaneously
<?php class App { public static $classes = array(); public function register($name, Callable $generator) { $this::$classes[$name] = $generator; } public function make($name) { if (!isset($this::$classes[$name])) { throw new Exception('Invalid class name'); } var_dump($this::$classes);exit; return $this::$classes[$name](); } } $app = new App; // Internal declaration class Foo { public static function bar() { return 'static'; } } $app->register('foo', function() { return new Foo; }); // Internal Usage class SomeController { public function view() { $app = new App; echo $app->make('foo')->bar(); } } // Some extending application class MyFoo extends Foo { public static function bar() { return 'can\'t make internal methods use this.'; } } $app->register('foo', function() { return new MyFoo; }); $c = new SomeController; $c->view();

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.0070.01116.50
8.3.60.0120.00318.30
8.3.50.0100.00721.88
8.3.40.0070.00718.87
8.3.30.0100.00719.08
8.3.20.0040.00420.29
8.3.10.0070.00022.10
8.3.00.0080.00022.57
8.2.180.0130.00716.88
8.2.170.0000.01522.96
8.2.160.0180.00020.87
8.2.150.0040.00424.18
8.2.140.0040.00424.66
8.2.130.0000.00826.16
8.2.120.0050.00319.38
8.2.110.0130.00322.26
8.2.100.0060.00619.76
8.2.90.0000.00819.30
8.2.80.0110.00017.97
8.2.70.0050.00517.75
8.2.60.0090.00018.03
8.2.50.0070.00418.07
8.2.40.0040.00418.16
8.2.30.0040.00418.02
8.2.20.0040.00417.79
8.2.10.0030.00519.59
8.2.00.0040.00417.80
8.1.280.0140.00725.92
8.1.270.0080.00023.92
8.1.260.0080.00026.35
8.1.250.0080.00028.09
8.1.240.0080.00023.80
8.1.230.0120.00019.15
8.1.220.0000.00817.74
8.1.210.0000.00818.77
8.1.200.0060.00317.35
8.1.190.0000.00817.51
8.1.180.0050.00318.10
8.1.170.0060.00318.62
8.1.160.0000.00722.02
8.1.150.0050.00218.74
8.1.140.0040.00417.51
8.1.130.0030.00317.85
8.1.120.0040.00417.51
8.1.110.0080.00017.44
8.1.100.0000.00717.39
8.1.90.0000.00717.41
8.1.80.0000.00717.37
8.1.70.0080.00017.43
8.1.60.0060.00317.52
8.1.50.0030.00617.51
8.1.40.0030.00517.45
8.1.30.0050.00317.57
8.1.20.0040.00417.57
8.1.10.0040.00417.49
8.1.00.0040.00417.55
8.0.300.0040.00418.77
8.0.290.0080.00017.04
8.0.280.0000.00718.47
8.0.270.0040.00417.27
8.0.260.0030.00516.82
8.0.250.0000.00816.93
8.0.240.0040.00417.02
8.0.230.0030.00316.93
8.0.220.0000.00816.97
8.0.210.0000.00716.94
8.0.200.0060.00317.07
8.0.190.0040.00316.93
8.0.180.0080.00316.88
8.0.170.0040.00416.93
8.0.160.0070.00017.02
8.0.150.0040.00416.97
8.0.140.0040.00416.83
8.0.130.0040.00413.36
8.0.120.0040.00416.95
8.0.110.0000.00716.93
8.0.100.0000.00717.01
8.0.90.0050.00216.99
8.0.80.0100.00717.04
8.0.70.0000.00817.00
8.0.60.0000.00716.84
8.0.50.0000.00717.01
8.0.30.0090.00917.11
8.0.20.0120.01117.40
8.0.10.0000.00717.05
8.0.00.0130.00516.84
7.4.330.0030.00315.15
7.4.320.0030.00316.59
7.4.300.0030.00316.59
7.4.290.0050.00316.52
7.4.280.0040.00416.64
7.4.270.0100.00016.68
7.4.260.0070.00416.55
7.4.250.0000.00716.51
7.4.240.0050.00316.58
7.4.230.0000.00716.50
7.4.220.0070.01116.48
7.4.210.0110.00516.64
7.4.200.0000.00816.34
7.4.190.0040.00416.72
7.4.160.0100.00616.46
7.4.150.0150.00317.40
7.4.140.0090.01317.86
7.4.130.0100.00816.49
7.4.120.0090.01016.55
7.4.110.0060.01316.61
7.4.100.0090.01216.57
7.4.90.0090.00916.63
7.4.80.0090.01219.39
7.4.70.0140.01016.61
7.4.60.0090.00916.63
7.4.50.0000.00816.32
7.4.40.0030.01222.77
7.4.30.0050.01116.52
7.4.00.0070.00714.92
7.3.330.0030.00313.30
7.3.320.0000.00513.30
7.3.310.0000.00716.40
7.3.300.0040.00416.35
7.3.290.0060.01216.46
7.3.280.0100.00616.44
7.3.270.0110.00817.40
7.3.260.0100.00716.41
7.3.250.0090.00816.46
7.3.240.0100.01016.39
7.3.230.0160.00316.45
7.3.210.0030.01416.65
7.3.200.0030.01319.39
7.3.190.0040.01216.63
7.3.180.0170.00316.52
7.3.170.0120.00316.55
7.3.160.0060.01016.50
7.3.120.0040.01114.91
7.2.330.0100.01016.85
7.2.320.0140.00416.89
7.2.310.0100.00716.72
7.2.300.0030.01616.86
7.2.290.0040.01416.49
7.2.60.0110.00416.84
7.2.50.0070.00717.09
7.1.200.0090.00615.97
7.1.100.0060.00918.13
7.1.70.0030.00917.13
7.1.60.0100.01419.82
7.1.50.0030.01916.95
7.1.00.0030.07722.45
7.0.200.0030.00616.46
7.0.140.0130.06722.21
7.0.60.0000.04720.02
7.0.50.0100.06017.95
7.0.40.0130.07720.26
7.0.30.0230.06320.12
7.0.20.0230.07320.16
7.0.10.0170.04720.26
7.0.00.0100.08020.22
5.6.280.0000.07721.10
5.6.210.0030.08720.52
5.6.200.0000.04318.25
5.6.190.0100.08020.61
5.6.180.0100.07720.45
5.6.170.0200.05320.54
5.6.160.0100.07720.47
5.6.150.0000.09018.24
5.6.140.0070.08718.23
5.6.130.0100.08318.15
5.6.120.0070.08721.02
5.6.110.0130.07720.99
5.6.100.0170.07321.13
5.6.90.0100.08721.09
5.6.80.0030.08020.45
5.6.70.0270.07320.54
5.5.350.0030.07320.46
5.5.340.0030.04317.95
5.5.330.0030.05020.27
5.5.320.0370.06720.28
5.5.310.0300.06720.37
5.5.300.0130.05717.93
5.5.290.0030.04317.95
5.5.280.0030.04020.74
5.5.270.0100.06020.79
5.5.260.0130.04320.99
5.5.250.0170.07720.73
5.5.240.0000.04020.14
5.4.450.0400.04019.42
5.4.440.0270.04019.17
5.4.430.0200.04319.19
5.4.420.0000.03319.29
5.4.410.0170.04719.07
5.4.400.0400.04019.17
5.4.390.0230.04719.00
5.4.380.0470.05018.54
5.4.370.0370.04718.70
5.4.360.0300.05718.52
5.4.350.0270.06018.70
5.4.340.0330.05318.51
5.4.320.0050.03612.52
5.4.310.0030.04212.52
5.4.300.0140.04212.52
5.4.290.0090.05012.52
5.4.280.0060.04112.41
5.4.270.0060.03712.38
5.4.260.0060.03812.38
5.4.250.0060.04012.38
5.4.240.0090.03912.38
5.4.230.0080.04812.37
5.4.220.0100.05312.38
5.4.210.0110.04612.37
5.4.200.0070.05212.37
5.4.190.0080.04412.37
5.4.180.0040.03812.36
5.4.170.0070.03712.38
5.4.160.0080.03612.38
5.4.150.0070.03712.37
5.4.140.0070.05012.05
5.4.130.0110.04312.04
5.4.120.0040.05112.00
5.4.110.0100.04512.00
5.4.100.0060.05812.00
5.4.90.0080.05112.00
5.4.80.0090.04312.00
5.4.70.0030.03711.99
5.4.60.0120.02911.99
5.4.50.0080.04411.99
5.4.40.0080.04611.98
5.4.30.0060.04311.98
5.4.20.0070.03511.97
5.4.10.0080.03211.97
5.4.00.0040.03711.46
5.3.290.0110.05612.80
5.3.280.0110.04212.71
5.3.270.0070.03712.73
5.3.260.0040.04012.72
5.3.250.0060.03812.72
5.3.240.0060.04612.72
5.3.230.0060.03812.71
5.3.220.0060.03712.68
5.3.210.0060.04212.68
5.3.200.0070.03512.68
5.3.190.0060.03712.68
5.3.180.0060.03612.67
5.3.170.0060.03812.67
5.3.160.0040.04012.68
5.3.150.0060.03712.67
5.3.140.0060.03612.66
5.3.130.0060.04012.66
5.3.120.0110.04612.65
5.3.110.0060.04712.66
5.3.100.0070.03812.12
5.3.90.0010.04112.09
5.3.80.0020.04012.08
5.3.70.0060.03612.07
5.3.60.0080.03812.06
5.3.50.0070.03912.00
5.3.40.0050.04012.00
5.3.30.0120.04911.97
5.3.20.0060.03511.75
5.3.10.0050.03711.73
5.3.00.0040.03711.70
5.2.170.0050.0309.18
5.2.160.0040.0329.18
5.2.150.0060.0319.18
5.2.140.0070.0289.18
5.2.130.0060.0349.14
5.2.120.0070.0309.14
5.2.110.0040.0309.15
5.2.100.0050.0329.15
5.2.90.0070.0359.14
5.2.80.0090.0289.14
5.2.70.0070.0299.14
5.2.60.0040.0329.08
5.2.50.0050.0319.06
5.2.40.0060.0289.04
5.2.30.0030.0329.00
5.2.20.0060.0349.01
5.2.10.0050.0298.92
5.2.00.0070.0298.77
5.1.60.0040.0248.05
5.1.50.0040.0308.05
5.1.40.0040.0278.04
5.1.30.0050.0308.39
5.1.20.0020.0288.41
5.1.10.0030.0288.13
5.1.00.0030.0418.13
5.0.50.0030.0216.61
5.0.40.0020.0206.46
5.0.30.0020.0326.28
5.0.20.0040.0236.26
5.0.10.0020.0226.23
5.0.00.0040.0316.22
4.4.90.0020.0234.78
4.4.80.0010.0164.75
4.4.70.0040.0164.75
4.4.60.0000.0264.76
4.4.50.0050.0184.77
4.4.40.0020.0264.71
4.4.30.0040.0144.76
4.4.20.0030.0154.84
4.4.10.0040.0164.85
4.4.00.0010.0284.76
4.3.110.0010.0184.67
4.3.100.0040.0144.67
4.3.90.0050.0174.63
4.3.80.0040.0234.58
4.3.70.0000.0174.63
4.3.60.0030.0144.63
4.3.50.0030.0154.63
4.3.40.0030.0244.54
4.3.30.0010.0173.28
4.3.20.0020.0163.26
4.3.10.0030.0153.23
4.3.00.0070.01715.08

preferences:
58.41 ms | 401 KiB | 5 Q