2 ms·
I see no reason why arrays should be objects. PHP is not Java even if a lot has been borrowed from it over the years. Array manipulation and associative arrays
by kyriakos 5y ago
I see no reason why arrays should be objects. PHP is not Java even if a lot has been borrowed from it over the years.
Array manipulation and associative arrays in PHP are some of its strong points. Yes they are easy to abuse but they are also extremely flexible and make development fast.
- zarzavat 5y agoThere's no reason for arrays to be objects if PHP wants to be a procedural language like C. In the days of PHP4 it was a procedural language and that design made total sense. However nowadays nobody uses PHP as a procedural language, they use it as an object-oriented language. In that context it is extremely strange to have this procedural API still hanging around for "old" types.
- kyriakos 5y agoThe only problem I see is that array functions are in global scope and not namespaced. Other than that having primitive types doesn't hurt.