3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php class ScreenLogger { public function debug($message, $data) { echo $message . "<br>" . var_export($data, true) . "<hr>"; } } class ExampleClass { public $logger; public function __construct($logger = null) { $this->logger = $logger; } public function __invoke() { if ($this->logger) { echo "hooray!"; } } } $logger = new ScreenLogger(); $example = new ExampleClass($logger); echo var_export($example->logger, true) . "\n"; $example();
based on 5MYM5
Output for 5.3.22 - 7.3.1
ScreenLogger::__set_state(array( )) hooray!