3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Test { private $x; private $y; public function __construct() { $this->x = 10; $this->y = function (){ return $this->getToutesLesCommandes();}; } public function getY($k) { return $this->$k; } public function getToutesLesCommandes() { //sleep(5); echo "Et 5 tres longues secondes plus tard..."; return array('commande1' => 123456, 'commande2' => 456789); } } $t = new Test(); //var_dump($t); var_dump($t->getY()); var_dump($t->getY());
Output for git.master, git.master_jit, rfc.property-hooks
Fatal error: Uncaught ArgumentCountError: Too few arguments to function Test::getY(), 0 passed in /in/iZQF5 on line 30 and exactly 1 expected in /in/iZQF5:14 Stack trace: #0 /in/iZQF5(30): Test->getY() #1 {main} thrown in /in/iZQF5 on line 14
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:
44.24 ms | 401 KiB | 8 Q