3v4l.org

run code in 300+ PHP versions simultaneously
<?php abstract class Foo { abstract protected static function things(); protected $t; protected function __construct($t) { $this->t = $t; } public function getT() { return $this->t; } public static function all() { return array_map(function($t) { return new static($t); }, static::things()); } } class Bar extends Foo { protected static function things() { return [10, 20, 30]; } } $bars = Bar::all(); foreach ($bars as $bar) { echo $bar->getT()."\n"; }
Output for git.master, git.master_jit, rfc.property-hooks
10 20 30

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.85 ms | 401 KiB | 8 Q