Reputation: 77
How do I access values of a static array in PHP?
$anyVar = self::MY_ARRAY['identifier']
throws 'unexpected [ after MY_ARRAY' at me.
Upvotes: 0
Views: 56
Reputation: 219834
You're missing your dollar sign
$anyVar = self::$MY_ARRAY['identifier'];
FYI, naming variables in uppercase should be reserved to constants by convention.
Upvotes: 1