3v4l.org

run code in 300+ PHP versions simultaneously
<?php final class MyTerribleCode { public function demo(): void { $a = 1; (static function () { eval( <<<'PHP' var_dump(get_defined_vars()); var_dump(isset($this)); try { var_dump(self::class); } catch (Error) { var_dump(null); } PHP ); })->bindTo(null, null)(); } } (new MyTerribleCode())->demo();
Output for 8.1.0 - 8.1.31, 8.2.0 - 8.2.27, 8.3.0 - 8.3.16, 8.4.1 - 8.4.2
array(0) { } bool(false) NULL

preferences:
51.23 ms | 406 KiB | 5 Q