3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Person { public $name; public function __construct($name) { $this->name = $name; } public function getData() { return ['name' => $this->name]; } // демонстрация позднего статического связывания public final function getFullData() { return static::getData(); } } class Student extends Person { public $education; public $place; public function __construct ($name, $education, $place) { parent::__construct($name); $this->education = $education; $this->place = $place; } public function getData() { return array_merge(parent::getData(), [ 'education' => $this->education, 'place' => $this->place ]); } } $s = new Student('Alex', 'science', 'MIT'); var_dump($s->getData()); var_dump($s->getFullData());
Output for git.master, git.master_jit, rfc.property-hooks
array(3) { ["name"]=> string(4) "Alex" ["education"]=> string(7) "science" ["place"]=> string(3) "MIT" } array(3) { ["name"]=> string(4) "Alex" ["education"]=> string(7) "science" ["place"]=> string(3) "MIT" }

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