3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Controller { protected $wrapped = []; public function abc($request) { // did we wrap this yet? if (! isset($this->wrapped['abc'])) { // if not, do it now. this will only happen once (unless you clear it out). $this->wrapped['abc'] = $this->wrap( function ($request) { return "abc\n"; } ); } // invoke and return. return $this->wrapped['abc']($request); } protected function wrap(callable $inner_controller) { return function($request) use ($inner_controller) { // stuff $response = $inner_controller($request); // stuff return $response; }; } } $ctrl = new Controller(); echo $ctrl->abc('the request');
Output for git.master, git.master_jit, rfc.property-hooks
abc

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.33 ms | 405 KiB | 5 Q