3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Pet { protected $_name; protected $_status = 'None'; protected $_petLocation = 'who knows'; // Want to replace this function public function playing($game = 'ball') { $this->_status = $this->_type . ' is playing ' . $game; return '<br>' . $this->_name . ' started to play a ' . $game; } public function getPetStatus() { return '<br>Status: ' . $this->_status; } } class Cat extends Pet { function __construct() { $this->_type = 'Cat'; echo 'Test: The ' . $this->_type . ' was born '; } // Replacing with this one public function playing($gameType = 'chess', $location = 'backyard') { $this->_status = 'playing ' . $gameType . ' in the ' . $location; return '<br>' . $this->_type . ' started to play a ' . $gameType . ' in the ' . $location; } } $cat = new Cat('Billy'); echo $cat->getPetStatus(); echo $cat->playing(); echo $cat->getPetStatus();
Output for git.master, git.master_jit, rfc.property-hooks
Deprecated: Creation of dynamic property Cat::$_type is deprecated in /in/Dm27r on line 23 Test: The Cat was born <br>Status: None<br>Cat started to play a chess in the backyard<br>Status: playing chess in the backyard

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