Array constant in PHP

A question asked privately:

Can I define an array constant in PHP?

No (see documentation), but there is a workaround you can use. You can serialize() an array and store the resulting string in a constant. When you need to use the array, unserialize() the constant.

This entry was posted in Answers, Technology. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *