3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Bear { private $age = 0; public function setAge($age) { if ($age < 0) { throw new Exception('Bear cannot have negative age dumbass'); } $this->age = $age; } public function getAge() { return $this->age; } } class BlackBear { private $name; public function setNameAndAge($name, $age) { $this->name = $name; $this->setAge($age); } } $bear1 = new Bear(); $bear1->setAge(35); $bear2 = new BlackBear(); $bear2->setNameAndAge('Harry', 45); var_dump($bear1->getAge()); var_dump($bear2->getAge());
Output for git.master, git.master_jit, rfc.property-hooks
Fatal error: Uncaught Error: Call to undefined method BlackBear::setAge() in /in/0CK9i:28 Stack trace: #0 /in/0CK9i(37): BlackBear->setNameAndAge('Harry', 45) #1 {main} thrown in /in/0CK9i on line 28
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:
51.19 ms | 401 KiB | 8 Q