3v4l.org

run code in 300+ PHP versions simultaneously
<?php error_reporting(E_ALL - E_STRICT); class A { private $message; public function __construct($msg) { $this->message = $msg; } public function test() { $self = 'this'; if (isset($this) === false) { $$self = new self('bar'); } $$self->show(); } public function show() { echo 'show: ', $this->message, "\n"; } } $o = new A('foo'); $o->test(); A::test();

preferences:
54.66 ms | 402 KiB | 5 Q