3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Greeter { private $boss; private $guests = array(); function __construct($boss) { $this->boss = $boss; } // returns welcome message for last guest public function greet() { if(count($this->guests) == 0){ $name = null; } else{ $name = array_pop($this->guests); $this->guests = array(); } if ($name == $this->boss) { return 'Very very welcome, '.$name; } else { return 'Welcome, '. $name; } } public function enters($name) { array_push($this->guests,$name); } } // For testing purposes (do not submit uncommented): $g = new Greeter('Chuck'); $g->enters('John'); $g->enters('John2'); echo $g->greet(); echo $g->greet();
Output for git.master, git.master_jit, rfc.property-hooks
Welcome, John2Welcome,

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