3v4l.org

run code in 500+ 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.31, 8.3.0 - 8.3.31, 8.4.1 - 8.4.22, 8.5.0 - 8.5.7
static::TABLE is child_const static::$table is child_var

preferences:
60.77 ms | 1018 KiB | 4 Q