<?php // overriding an untyped parent constant with a typed one class A { public const VALUE = 42; // untyped } class B extends A { public const float VALUE = 42.5; // narrowing to `float` } echo "Parent type: " . gettype(A::VALUE) . "\n"; echo "Child value: " . B::VALUE . "\n";
You have javascript disabled. You will not be able to edit any code.