3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Bicycle { protected $condition_id; protected const CONDITION_OPTIONS = [ 1 => 'Beat up', 2 => 'Decent', 3 => 'Good', 4 => 'Great', 5 => 'Like New' ]; public function __construct($arg=[]){ $this->condition_id = $arg['condition_id'] ?? 3; } public function condition(){ if($this->condition_id > 0){ return self::CONDITION_OPTIONS[$this->condition_id]; }else{ return "Unknown"; } } } $arg = ['condition_id' => 2]; $bike = new Bicycle($arg); echo $bike->condition();
Output for git.master, git.master_jit, rfc.property-hooks
Decent

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:
169.42 ms | 405 KiB | 5 Q