- var_dump: documentation ( source)
<?php
function test()
{
//It's crucial to construct it in the same line
return new class{ static $foo = '-'; };
}
$x = test();
$x::$foo = 'x';
$y = test();
$y::$foo = 'y';
var_dump($x::$foo, $y::$foo, ($x === $y), (get_class($x) === get_class($y)));