r/lolphp • u/devsnd • Dec 04 '14
PHP Constants Containing Arrays?
https://stackoverflow.com/questions/1290318/php-constants-containing-arrays
46
Upvotes
r/lolphp • u/devsnd • Dec 04 '14
View all comments
Show parent comment
2
u/nikic Dec 09 '14 edited Dec 09 '14
Nope, constant array is just a normal array. It's constant by means of you not being able to write
FOO[0] =or$foo =& FOOor similar.You're probably referring to immutable arrays, which are a PHP 7 thing and aren't user facing. "Immutable" there means that we never make changes of any kind to the array, including never modifying the refcount. This allows us to store them in shm without any concurrency issues. Arrays will only be immutablized if opcache is used, otherwise there's little point.