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'); } 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)
5.4.270.0030.03812.38
5.4.260.0020.04112.38
5.4.250.0070.03512.38
5.4.240.0080.03312.38
5.4.230.0070.03612.38
5.4.220.0080.03412.37
5.4.210.0080.03412.38
5.4.200.0040.04012.37
5.4.190.0050.03612.37
5.4.180.0040.03812.37
5.4.170.0050.03712.37
5.4.160.0030.03912.37
5.4.150.0020.04012.37
5.4.140.0030.04012.05
5.4.130.0020.03912.04
5.4.120.0060.03512.00
5.4.110.0030.03712.00
5.4.100.0050.03512.00
5.4.90.0030.03912.00
5.4.80.0040.03912.00
5.4.70.0060.03311.99
5.4.60.0050.03512.00
5.4.50.0080.03212.00
5.4.40.0080.03211.98
5.4.30.0040.03611.98
5.4.20.0070.03311.98
5.4.10.0060.03411.98
5.4.00.0060.03511.47
5.3.280.0060.04312.71
5.3.270.0070.04212.72
5.3.260.0050.03912.72
5.3.250.0060.03712.72
5.3.240.0040.03812.72
5.3.230.0070.03612.71
5.3.220.0030.04512.68
5.3.210.0070.03812.68
5.3.200.0090.03412.68
5.3.190.0020.04212.67
5.3.180.0070.03512.67
5.3.170.0020.04012.67
5.3.160.0050.03712.67
5.3.150.0050.03812.68
5.3.140.0070.04012.66
5.3.130.0060.03812.66
5.3.120.0060.03812.66
5.3.110.0050.03912.66
5.3.100.0060.03712.11
5.3.90.0030.03912.09
5.3.80.0070.03612.07
5.3.70.0040.03812.07
5.3.60.0060.03712.07
5.3.50.0040.03712.00
5.3.40.0070.03612.00
5.3.30.0020.03811.95
5.3.20.0060.03411.73
5.3.10.0050.03611.70
5.3.00.0060.03511.68

preferences:
146.51 ms | 1394 KiB | 7 Q