3v4l.org

run code in 300+ PHP versions simultaneously
<?php declare(strict_types=1); class TestClass { public int $a; } $test = new TestClass(); $string = 'foo'; $test->int = &$string; var_dump($test->int); $test->int = []; var_dump($test->int);
based on Es3XA
Output for 7.4.0 - 7.4.14, 8.0.0 - 8.0.3
string(3) "foo" array(0) { }
Output for 7.3.0 - 7.3.26
Parse error: syntax error, unexpected 'int' (T_STRING), expecting function (T_FUNCTION) or const (T_CONST) in /in/F6pnT on line 5
Process exited with code 255.