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

Popular posts from this blog

How do I check if an insert was successful with MySQLdb in Python? -

delphi - blogger via idHTTP : error 400 bad request -

postgresql - ERROR: operator is not unique: unknown + unknown -