3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { public function sing() { var_dump('Do re mi!'); } public function dance() { var_dump('Cha cha cha!'); } } function gimmeFoo(Foo $foo) { $foo->sing(); $foo->dance(); } $gimmeWhat = new ReflectionFunction('gimmeFoo'); $class = $gimmeWhat->getParameters()[0]->getClass(); $methods = $class->getMethods(); $evil = " class Fake extends $class->name { public function idoeverything() { var_dump('Just kidding!'); } "; foreach ($methods as $method) { $evil .= "public function $method->name() {\$this->idoeverything();}"; } $evil .= "}"; eval($evil); $fake = new Fake; gimmeFoo($fake);
Output for git.master, git.master_jit, rfc.property-hooks
Deprecated: Method ReflectionParameter::getClass() is deprecated in /in/uMXpl on line 23 string(13) "Just kidding!" string(13) "Just kidding!"

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:
48.65 ms | 401 KiB | 8 Q