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?

-- 
Andrew Faulds (AJF)
http://ajf.me/

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to