3v4l.org

run code in 300+ PHP versions simultaneously
<?php declare(strict_types=1); class Bug { private static $foo; private static int $bar; } $rc = new ReflectionClass(Bug::class); var_dump($rc->getStaticPropertyValue('foo')); var_dump($v = $rc->getStaticPropertyValue('bar')); echo "bar = {$v}\n";
Output for 8.1.0 - 8.1.33, 8.2.0 - 8.2.29, 8.3.0 - 8.3.26, 8.4.1 - 8.4.14
NULL UNKNOWN:0 Warning: Undefined variable $v in /in/56CNK on line 11 bar =

preferences:
95.67 ms | 406 KiB | 5 Q