3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Test { public static $x = 0; } class Test2 extends Test { // $x is inherited } class Test3 extends Test { // $x is NOT inherited public static $x = 3; } $x = 1; Test2::$x = &$x; var_dump(Test::$x, Test2::$x, Test3::$x); // int(1), int(1), int(3) ?>
Output for 8.1.32 - 8.1.34, 8.2.0 - 8.2.30, 8.3.0 - 8.3.30, 8.4.1 - 8.4.18, 8.5.0 - 8.5.3
int(1) int(1) int(3)

preferences:
59.99 ms | 843 KiB | 4 Q