3v4l.org

run code in 300+ PHP versions simultaneously
<?php abstract class Super { private $aliases; protected function __construct(array $aliases) { $this->aliases = $aliases; } public function __call($name, $arguments) { /* if $name is an alias, replace it */ if (isset($this->aliases[$name])) { $name = $this->aliases[$name]; } /* throw an exception if the method is undefined */ if (!method_exists($this, $name)) { throw new Exception("The specified method or method alias is undefined in the current context"); } /* finally, call the method by its actual name */ return $this->$name($arguments); } } class Sub extends Super { public function __construct() { parent::__construct(array( "alias" => "actualMethod" )); } public function actualMethod() { echo "Inside the actual method"; } } $sub = new Sub; $sub->actualMethod(); $sub->alias();
Output for git.master, git.master_jit, rfc.property-hooks
Inside the actual methodInside the actual method

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