3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Yoba { private int $age; public function getAge () : int { return $this->age; } public function setAge (int $age) : void { if (!$this->ageIsValid($age)) { throw new Exception("0 < \$age <= 100, passed " . $age); } $this->age = $age; } public function ageIsValid (int $age) : bool { if (($age > 0) && ($age <= 100)) { return true; } return false; } } $yo = new Yoba(); $yo->setAge(10); echo $yo->getAge(); $yo->setAge(1000); echo $yo->getAge();
Output for git.master_jit, git.master, rfc.property-hooks
10 Fatal error: Uncaught Exception: 0 < $age <= 100, passed 1000 in /in/7ldLa:12 Stack trace: #0 /in/7ldLa(28): Yoba->setAge(1000) #1 {main} thrown in /in/7ldLa on line 12
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:
27.29 ms | 405 KiB | 5 Q