3v4l.org

run code in 300+ PHP versions simultaneously
<?php class A { private $log; function __construct() { $this->log = function () { echo 'log'; }; } private function privateMethod() { echo 'calling private method'; } public function __call($method, $args) { if (is_callable(array($this, $method))) { return call_user_func_array($this->$method, $args); } } } $a = new A(); $a->log(); $a->privateMethod();
Output for git.master, git.master_jit, rfc.property-hooks
log Warning: Undefined property: A::$privateMethod in /in/N5iFP on line 17 Fatal error: Uncaught TypeError: call_user_func_array(): Argument #1 ($callback) must be a valid callback, no array or string given in /in/N5iFP:17 Stack trace: #0 /in/N5iFP(24): A->__call('privateMethod', Array) #1 {main} thrown in /in/N5iFP on line 17
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:
45.97 ms | 401 KiB | 8 Q