3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Base { public static function describe() { static $description = null; if ($description === null) { $description = "I am a " . static::getName() . "\n"; } return $description; } } class Car extends Base { protected static function getName() { return 'car'; } } class Peugot extends Car { protected static function getName() { return 'peugot'; } } class Renault extends Car { protected static function getName() { return 'renault'; } public static function describe() { return 'Vroom! ' . parent::describe(); } } echo Peugot::describe(); echo Renault::describe(); echo Car::describe();
Output for git.master, git.master_jit, rfc.property-hooks
I am a peugot Vroom! I am a peugot I am a peugot

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