3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Magic { private $vars; public function __get($name) { return $this->get($name); } public function __set($name, $value) { $this->set($name, $value); } public function get($name) { return $this->vars[$name](); } public function set($name, $value) { $this->vars[$name] = $value; } } $magic = new Magic(); $magic->a = function () use($magic) { $magic->b; }; $magic->b = function () use ($magic) { $magic->a; // Почему тут не может найти свойство, оно ЕСТЬ смотри строку 22 }; $magic->a; // Должна быть бесконечный вызов функций (на уровне вложенности 10 по умолчанию должна быть ошибка) // А вот тут тоже самое но без использования магии и ведет себя как надо $magic->set('a', function () use($magic) { $magic->get('b'); }); $magic->set('b', function () use($magic) { $magic->get('a'); }); $magic->get('a');
Output for git.master, rfc.property-hooks
Warning: Undefined property: Magic::$a in /in/3TEJA on line 26 Fatal error: Out of memory (allocated 35651584 bytes) (tried to allocate 262144 bytes) in /in/3TEJA on line 35 mmap() failed: [12] Cannot allocate memory mmap() failed: [12] Cannot allocate memory
Process exited with code 255.
Output for git.master_jit
Warning: Undefined property: Magic::$a in /in/3TEJA on line 26 Fatal error: Out of memory (allocated 18874368 bytes) (tried to allocate 262144 bytes) in /in/3TEJA on line 35 mmap() failed: [12] Cannot allocate memory mmap() failed: [12] Cannot allocate memory
Process exited with code 255.

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
40.5 ms | 401 KiB | 8 Q