3v4l.org

run code in 300+ PHP versions simultaneously
<?php interface MakeMeCMS_Listener_interface { public function __construct($method, $args); public function setFeedback($arg, $type); public function feedback(); } class MakeMeCMS_Listener implements MakeMeCMS_Listener_interface { private $_feedback; private $_type; public function __construct($method, $args = '') { if(method_exists($this, $method)) { if($args != '') { if(preg_match('#\,#', $args)) { $args = explode(',', $args); } $this->$method($args); } else { $this->$method(); } } } public function setFeedback($arg,$type) { $this->_feedback = $arg; $this->_type = $type; } public function feedback() { return $this->_feedback; } private function test(array $args) { $string = ''; foreach($args as $arg) { $string .= $arg.' '; } $this->setFeedback($string, 'text/plain'); } } class myAddon_Listener extends MakeMeCMS_Listener implements MakeMeCMS_Listener_interface { public function __construct($method, $args = '') { if(method_exists($this, $method)) { if($args != '') { if(preg_match('#\,#', $args)) { $args = explode(',', $args); } $this->$method($args); } else { $this->$method(); } } } public function setFeedback($arg, $type) { parent::setFeedback($arg, $type); } public function feedback() { return parent::_feedback; } private function test2() { echo('Hello World!'); } } $listener = new MakeMeCMS_Listener('test', 'foo,bar'); echo($listener->feedback()); $customListener = new myAddon_Listener('test2'); echo($customListener->feedback());
Output for git.master, git.master_jit, rfc.property-hooks
foo bar Hello World! Fatal error: Uncaught Error: Undefined constant MakeMeCMS_Listener::_feedback in /in/XgI5B:56 Stack trace: #0 /in/XgI5B(65): myAddon_Listener->feedback() #1 {main} thrown in /in/XgI5B on line 56
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:
48.96 ms | 401 KiB | 8 Q