Before 5.6, a constant or a default parameter value had to be a literal. Anything computed — even multiplying two numbers you had already defined — was a parse error, so codebases ended up with magic numbers whose derivation lived in a comment.
class Cache
{
const MINUTE = 60;
const HOUR = self::MINUTE * 60;
const DAY = self::HOUR * 24;
public function remember($key, $ttl = self::HOUR * 6)
{
// ...
}
}
The expression is evaluated at compile time, so there is no runtime cost, but it only accepts other constants and literals — no function calls, no property access. It is a small change that removes a whole category of comment: the number now states what it is instead of what it equals.