3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { private $value = 'HI'; public function filter_callable(callable $p) { return $p($this); } public function filter_closure(\Closure $p) { return $p($this); } private function getValue() { return $this->value; } } $foo = new Foo(); echo $foo->filter_callable([$foo, 'getValue']); echo $foo->filter_closure(function($p) { return $p->getValue(); });
Output for git.master_jit, git.master, rfc.property-hooks
HI Fatal error: Uncaught Error: Call to private method Foo::getValue() from global scope in /in/7TSf2:27 Stack trace: #0 /in/7TSf2(14): {closure}(Object(Foo)) #1 /in/7TSf2(26): Foo->filter_closure(Object(Closure)) #2 {main} thrown in /in/7TSf2 on line 27
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:
74.68 ms | 401 KiB | 8 Q