No Cast In Constant Expressions

no-email (Damien Seguy), Damien Seguy
Tue, 30 Jul 2024 00:00:00 +0000

Constant expressions do not accept the cast operator.
Constant expressions are expressions defining constants and default values. They allow a subset of PHP features, as they are avaiable before the execution phase. For example, they accept operators, such as addition and concatenation. Yet, they do not accept the cast operators, even though they might be emulated in another way. Here, the + operator creates the integer, from another string.