3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Productss{ protected $title; protected $category; const CHANGES_SAVED = 'Wijzigingen opgeslagen'; public function __construct($title, $category){ $this->title = $title; $this->category = $category; } public function someFunction(){ self::CHANGES_SAVED; // CHANGES_SAVED not changeable in this class, it is changeable in a child class } public function getCategory(){ return $this->category; } public function getTitle(){ return $this->title; } } class Order extends Productss{ protected $price; protected $deliver; //const CHANGES_SAVED = 'Wijzigingen nu opgeslagen'; public function __construct($title, $category, $price){ parent::__construct($title, $category); $this->price = $price; $this->doWeDeliver(); } public function getPrice(){ return $this->price; } public function getDeliver(){ return $this->deliver; } protected function doWeDeliver(){ $this->deliver = $this->price > 30 ? 'Yes' : 'No' ; } } //$order = new Order('CD Brahms', 'Media', '45'); //echo 'Product :'.$order->getTitle(); //echo 'Categorie :'.$order->getCategory(); //echo 'Prijs :'.$order->getPrice(); //echo 'Gratis bezorging :'.$order->getDeliver(); //echo Productss::CHANGES_SAVED.'<br />'; // 300 //echo Order::CHANGES_SAVED.'<br />'; // 500 echo Order::__FILE__.'<br />'; // 500
Output for git.master, git.master_jit, rfc.property-hooks
Fatal error: Uncaught Error: Undefined constant Order::__FILE__ in /in/RXNkW:55 Stack trace: #0 {main} thrown in /in/RXNkW on line 55
Process exited with code 255.

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