3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Product { /* Static Methos and Properties example */ public static $manufacturer = "Bart Taylor"; public $name = 'default_name'; public $price = 0; public $desc = 'default description'; function __construct($name, $price, $desc){ $this->name = $name; $this->price = $price; $this->desc = $desc; } public function getInfo(){ return "Product Name: ". $this->name; } public function getMaker(){ return self::$manufacturer; } } /* Part on Object Inheritance */ //SUB-CLASS class Soda extends Product { public $flavor; function __construct($name, $price, $desc, $flavor){ parent::__construct($name, $price, $desc); $this->favor = $flavor; } public function getInfo(){ return "Product Name: ". $this->name . "Flavor: ". $this->flavor; } } $shirt = new Product("Space Juice T-Shirt", 20, "Awesome Grey T-Shirt");
Output for git.master, git.master_jit, rfc.property-hooks

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