3v4l.org

run code in 300+ PHP versions simultaneously
<?php function test($label = '') { global $t; $t2 = microtime(1); if ($label) echo str_pad($label . ': ', 32, '.', STR_PAD_RIGHT) . ' ' . 1000 * ($t2 - $t) . 'ms' . "\n"; $t = $t2; } class Foo2 { public function fooLoop() { for ($i = 1000000; $i--;) $this->foo(); } public function barLoop() { for ($i = 1000000; $i--;) $this->bar(); } public function bazLoop() { for ($i = 1000000; $i--;) $this->baz(); } public function foo() { } protected function bar() { } private function baz() { } } $f = new Foo2(); test(); $f->fooLoop(); test('pub'); $f->barLoop(); test('pro'); $f->bazLoop(); test('pri');

preferences:
24.54 ms | 402 KiB | 5 Q