PHP 7 arrays

So why didn’t the PHP devs make support for constant arrays earlier like PHP 5.6? I would of thought that constant arrays would already be supported since they made that addition of const EXAMPLE = 'Example constant'; outside of classes.

Have you read the Php Manual regarding constants and arrays?

Not yet, but I was just saying why couldn’t they add this feature in previous versions? Why release it after so long? A while back, I attempted to append an array to a constants using the define option and it gave me the array to string conversion error (wrong error, I don’t recall what it is off the top of my head). It would be a lot easier if they released this feature when they allowed const EXAMPLE = 'Example constant'; outside of classes.

I agree that earlier PHP versions regarding defines/constants was sadly lacking especially after using C and Pascal, both of which have elegant structured features that could be easily swapped.

In PHP’s defence they do have a wealth of array functions which can be used globally.

1 Like

Thanks. I can see why now. There’s already multiple ways of declaring an array so adding a few more would be unnecessary.

1 Like

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.