No Cast In Constant Expressions

../_images/no_cast_in_constant_expression.png

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 available 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.

See Also

PHP Error Messages

PHP Features