3v4l.org

run code in 300+ PHP versions simultaneously
<?php abstract class AbstractClass { abstract function __construct(); // Our abstract method only needs to define the required arguments abstract protected function prefixName($name); } class ConcreteClass extends AbstractClass { public function __construct($a=9) { echo $a; } // Our child class may define optional arguments not in the parent's signature public function prefixName($name, $separator=0 ) { if ($name == "Pacman") { $prefix = "Mr"; } elseif ($name == "Pacwoman") { $prefix = "Mrs"; } else { $prefix = ""; } return "{$prefix}{$separator} {$name}"; } } $class = new ConcreteClass(6600); echo $class->prefixName("Pacman"), "\n"; echo $class->prefixName("Pacwoman"), "\n"; ?>
Output for git.master, git.master_jit, rfc.property-hooks
6600Mr0 Pacman Mrs0 Pacwoman

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:
41.97 ms | 401 KiB | 8 Q