3v4l.org

run code in 300+ PHP versions simultaneously
<?php class MyQuery{ public function query() { die('callable called'); } } class QueryHandler { public $query; public function setQuery(callable $query) { echo "checkpoint 1 reached"."\n"; $this->query = $query; } public function runQuery(){ $this->$query(); echo "end (should not show)"."\n"; } } echo "start"."\n"; $myQuery = new MyQuery; $queryHandler = new QueryHandler; $queryHandler->setQuery($myQuery->query); $queryHandler->runQuery();
Output for git.master, git.master_jit, rfc.property-hooks
start Warning: Undefined property: MyQuery::$query in /in/9TgDG on line 37 Fatal error: Uncaught TypeError: QueryHandler::setQuery(): Argument #1 ($query) must be of type callable, null given, called in /in/9TgDG on line 37 and defined in /in/9TgDG:19 Stack trace: #0 /in/9TgDG(37): QueryHandler->setQuery(NULL) #1 {main} thrown in /in/9TgDG on line 19
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:
52.9 ms | 402 KiB | 8 Q