PHP 5.4 features poll: the results

DZone 's Guide to

PHP 5.4 features poll: the results

· Web Dev Zone ·
Free Resource
After two weeks, we have closed the poll among the PHP community of Web Builder Zone to establish which are the most wanted features, which will influence development of applications on PHP 5.4. Hopefully this poll would also shape our focus in tutorials in the future - I personally plan to dedicate more time to the winning features.

The runners-up

Some innovations of PHP 5.4 have not stand the test of the crowd: deprecation of magic quotes and other strict mode changes did not receive many votes, as well as the closures new features like the binding of $this.

Even the built-in HTTP server, which is quite handy during development, did not manage to hit the podium.

3rd place: upload progress patch (11%)

The upload progress feature is not cited in many places as groundbreaking, as it was always available as a patch for 5.3. However, recompiling PHP has the same issues than changing from 5.3 to 5.4: now the patch will also be available on shared hosting and in other hosting services which do not provide the control over the PHP binary you can use.

Evidently, with a larger and larger usage of the cloud, upload of large files needs monitoring and, as an example, I cannot think of a Gmail without uploading progress. With the upload progress patch in the core and some optional support from frameworks, this would become a commodity in the PHP world.

2nd place: traits (29%)

Traits for horizontal code reuse are the mostly marketed feature of PHP 5.4, but they didn't get the first prize.

However, many people like me are probably unsure about how to use traits effectively, a dimension of design which we need to explore further. It's easy to make a mess with a powerful language in our hands - so before start cranking out traits instead of classes we should take a look at which problems they are going to solve and which are more suitable to other approaches, like composition and abstract classes.

1st place: arrays improvements (37%)

Arrays are the superglue of PHP: they work as collections, list, sets, maps, and more. We quotidianely wrap them to provide more complex classes and in the basic form they are supported by a large set of native functions for whatever purpose, from search to ordering and other manipulations.

Dereferencing was the feature introduced first, but the new notation is probably the motive behind the popularity of this choice in the poll. I listened to JavaScript guys complaining about lack of native JSON support for months - what we get is not a JSON parser, but a notation which is as powerful and concise, and is consistent with the PHP look&feel.

Some other comments we got

PHP has an increasing duck typing versus defined interfaces conflict: both kinds of styles are supported. Are traits oriented to duck typing? For now yes, as objects traits are not distinguishable if not for the presence or absence of methods: instanceof works only with classes.

Of course there is a bit of surprise for traits not being the most wanted feature. Or maybe I have spoiled the audience in not expecting addition to the OOP model to be more revolutionary than practising of a OO design book? Yet mixins, a similar concept, is diffused in many other circles, even in Smalltalk, the original OO language.

These are the full results.




Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}