php - Concatenation in constant-definition -
php - Concatenation in constant-definition -
i'm trying create little enum , i'm stuck: why doesn't work?
class.layoutparts.php:
<?php class layoutparts { const main = 1; const footer = 2; } ?>
class.supportedlayouts.php:
<?php class supportedlayouts { const main = layoutparts::main; const main_footer = layoutparts::main.layoutparts::footer; } ?>
it results next message:
parse error: syntax error, unexpected '.', expecting ',' or ';' in /*****/class.supportedlayouts.php on line 4
thanks help!
regards, flo
.
operator, making layoutparts::main.layoutparts::footer;
statement, isn't allowed in const
or property declaration.
see here
the value must constant expression, not (for example) variable, property, result of mathematical operation, or function call.
php const concatenation
Comments
Post a Comment