3v4l.org

run code in 300+ PHP versions simultaneously
<?php if (PHP_VERSION !== '7.2.0alpha2') die('Meh'); 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; } $c = 1; $c2 = 1; class A { public $a = 123; public function __construct() { unset($this->a); } public function a1() { } public function a2() { fopen('php://input'); } public function __get($name) { return 321; } } test(); for ($i = $c; $i--;) { $a = new A(); for ($j = $c2; $j--;) { $x = $a->a; } } test('__get'); for ($i = $c; $i--;) { $a = new A(); for ($j = $c2; $j--;) { $x = $a->a1(); } } test('empty()'); for ($i = $c; $i--;) { $a = new A(); for ($j = $c2; $j--;) { $x = $a->a2(); } } test('fopen()');

preferences:
31.05 ms | 402 KiB | 5 Q