On Tue, Jul 17, 2012 at 1:27 AM, Andrew Faulds <ajf...@googlemail.com>wrote:
> Hi there, > > Through its history, PHP has slowly become more object-oriented. PHP > today has classes, interfaces, objects, namespaces, and so on. > However, much of the language's core functionality is entirely > procedural, composed of functions and constants, much of which are > badly organised and inconsistently named. > > I think PHP could benefit from making arrays, strings, integers, > floats, and possibly booleans, into "pseudo-objects". By this I mean > that they are not really objects (they are still primitive types and > keep their passing semantics), but they have methods. For instance, > instead of array_keys($array), one could do $array->keys(); > > Adding this would make PHP feel more modern and allow people to > embrace more object-oriented programming styles. As a bonus, it would > also give a chance to make the string/array/etc functions better and > more consistently named and possibly implemented. > > I am working on an implementation of this for arrays, but I haven't > got very far. However, for someone that knows the Zend engine > internals, it does not appear to me that adding such things would be > very difficult. > > Thoughts? > > we have that brought up once or twice in the past, last time it was Rasmus who mentioned that it could be nice: http://marc.info/?l=php-internals&m=130159506720600&w=2 -- Ferenc Kovács @Tyr43l - http://tyrael.hu