3v4l.org

run code in 300+ PHP versions simultaneously
<?php class A { private static $sfoo = 1; private $ifoo = 2; } $cl1 = static function() { return A::$sfoo; }; echo $cl1(), "\n"; ?>
Output for 8.4.1 - 8.4.14
Fatal error: Uncaught Error: Cannot access private property A::$sfoo in /in/iLVpZ:7 Stack trace: #0 /in/iLVpZ(10): {closure:/in/iLVpZ:6}() #1 {main} thrown in /in/iLVpZ on line 7
Process exited with code 255.
Output for 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.33, 8.2.0 - 8.2.29, 8.3.0 - 8.3.27
Fatal error: Uncaught Error: Cannot access private property A::$sfoo in /in/iLVpZ:7 Stack trace: #0 /in/iLVpZ(10): {closure}() #1 {main} thrown in /in/iLVpZ on line 7
Process exited with code 255.

preferences:
181.01 ms | 409 KiB | 5 Q