how can I get around no arrays as class constants in php?
Posted
by user151841
on Stack Overflow
See other posts from Stack Overflow
or by user151841
Published on 2010-05-13T19:28:40Z
Indexed on
2010/05/13
19:34 UTC
Read the original article
Hit count: 169
I have a class with a static method. There is an array to check that a string argument passed is a member of a set. But, with the static method, I can't reference the class property in an uninstantiated class, nor can I have an array as a class constant.
I suppose I could hard code the array in the static method, but then if I need to change it, I'd have to remember to change it in two places. I'd like to avoid this.
© Stack Overflow or respective owner