3v4l.org

run code in 300+ PHP versions simultaneously
<?php class A { private function __construct() {} public static function greet() { echo "Hi!\n"; } } A::greet(); new A();
Output for 8.1.0 - 8.1.30, 8.2.0 - 8.2.26, 8.3.0 - 8.3.14, 8.4.1
Hi! Fatal error: Uncaught Error: Call to private A::__construct() from global scope in /in/l6kOh2:12 Stack trace: #0 {main} thrown in /in/l6kOh2 on line 12
Process exited with code 255.

preferences:
30.32 ms | 406 KiB | 5 Q