3v4l.org

run code in 500+ PHP versions simultaneously
<?php class A { protected string $context; public function run() { assert( $this->context !== null, 'Context must be set before run() is called' ); } } (new A())->run();
Output for 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.34, 8.2.0 - 8.2.36, 8.3.0 - 8.3.37, 8.4.1 - 8.4.28, 8.5.0 - 8.5.13, 8.6.0
Fatal error: Uncaught Error: Typed property A::$context must not be accessed before initialization in /in/3afAK:10 Stack trace: #0 /in/3afAK(16): A->run() #1 {main} thrown in /in/3afAK on line 10
Process exited with code 255.

preferences:
15.04 ms | 1164 KiB | 6 Q