3v4l.org

run code in 300+ PHP versions simultaneously
<?php abstract class ParentClass { public static function demo() { echo 'static::TABLE is ', static::TABLE, "\n"; echo 'static::$table is ', static::$table, "\n"; } } class ChildClass extends ParentClass { public const TABLE = 'child_const'; public static string $table = 'child_var'; } ChildClass::demo();
Output for 8.1.0 - 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
static::TABLE is child_const static::$table is child_var

preferences:
55.97 ms | 980 KiB | 4 Q