3v4l.org

run code in 500+ PHP versions simultaneously
<?php enum MethodConstraint :string { case A = "a"; case B = "b"; case C = "c"; public function getMethod(): string { return $this->value; } public function getMethodSentence($value): string { return match ($value) { MethodConstraint::A => "This is an A char", MethodConstraint::B => "This is a B char", MethodConstraint::C => "This is a C char" }; } public function getCharAndSentence(): string { return $this->getMethod()." ".$this->getMethodSentence($this); } } $aChar = MethodConstraint::A; echo $aChar->getMethod().PHP_EOL; echo $aChar->getMethodSentence(MethodConstraint::B).PHP_EOL; echo $aChar->getCharAndSentence();
Output for git.master, git.master_jit, rfc.property-hooks
a This is a B char a This is an A char

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:
38.1 ms | 984 KiB | 4 Q