Can I declare Constant array

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
johnhelen
Forum Commoner
Posts: 45
Joined: Mon Feb 19, 2007 9:17 pm

Can I declare Constant array

Post by johnhelen »

Hello

When I declare like this

DEFINE ( "MYCODES", array("123","321"));

There is error:

Warning: Constants may only evaluate to scalar values in...

How I can fix this
Thanks
User avatar
xpgeek
Forum Contributor
Posts: 146
Joined: Mon May 22, 2006 1:45 am
Location: Kyiv, Ukraine
Contact:

Post by xpgeek »

No you can not.

You can replace constant by static variable.
Post Reply