3v4l.org

run code in 500+ PHP versions simultaneously
<?php abstract class TT { abstract public static function xd(); } class Test { protected const ASD = 23; private static int $field = 5; public string $foo = 'default value' { get { var_dump(debug_backtrace()); return $this->foo; } set(string $value) { var_dump(debug_backtrace()); } } public static function &getSomeProperty() { return self::$field; } } $a =& Test::getSomeProperty(); if ($a === 5) { $a = 2; } var_dump(Test::getSomeProperty()); // 2 $test = new Test(); $test->foo;
Output for 8.4.1 - 8.4.21, 8.5.0 - 8.5.6
int(2) array(1) { [0]=> array(7) { ["file"]=> string(9) "/in/BFo3Z" ["line"]=> int(39) ["function"]=> string(9) "$foo::get" ["class"]=> string(4) "Test" ["object"]=> object(Test)#1 (1) { ["foo"]=> string(13) "default value" } ["type"]=> string(2) "->" ["args"]=> array(0) { } } }
Output for 8.3.0 - 8.3.30
Parse error: syntax error, unexpected token ";" in /in/BFo3Z on line 16
Process exited with code 255.

preferences:
48.73 ms | 723 KiB | 4 Q