3v4l.org

run code in 500+ PHP versions simultaneously
<?php final class KeepSelfClassStaticCall { public function run() { return self::class::sampleClass(); } private function sampleClass() { return 'very creative'; } } $obj = new KeepSelfClassStaticCall(); var_dump($obj->run());
Output for 8.0.30, 8.2.31 - 8.2.32, 8.3.0 - 8.3.32, 8.4.1 - 8.4.23, 8.5.0 - 8.5.8
string(13) "very creative"
Output for 7.4.33
Parse error: syntax error, unexpected '::' (T_PAAMAYIM_NEKUDOTAYIM), expecting ';' in /in/j07fn on line 7
Process exited with code 255.

preferences:
46.08 ms | 773 KiB | 4 Q