The
new version, 5.4 of PHP has finally arrived, and it comes up with a
string of new features that is extremely important for the developers to
know or need to have a grip on. While there are features that have
already been there in PHP, and have only been further developed, there
are certain features that have been added afresh.
Traits
This
is one of the most significant features of the version 5.4, which
consists of code fragments or a set or string of methods, which can be
used repeatedly across the classes horizontally. In case of other
languages, mixins or multiple inheritances address this particular
issue. However, traits do not offer states in forms of properties. It
offers a copy and paste method that is assisted by interpreter.
Moreover, traits come up with a unique conflict resolution mechanism.
Besides, the multiple traits can be used in the same class, even if
certain methods are overlapping.
Improved Arrays though syntax and dereferencing
Arrays
act like super glue In PHP. They are one of the strongest as well as
the longest constructs. As a result of this, shorter syntaxes can also
be used in the new version for defining in associative as well as
numerical way. The structure of the syntax introduces brackets as
short-hand, which has properly been defined and included in PHP scripts.
HTTP Server that is built-in
It
also comes up with an in-built HTTP Server for current directories, for
the purpose of testing as well as development. Then there are a number
of additional options, which include customer document root as well as a
router script that can be called upon each request.
Built-in Web Server (CLI)
CLI
Server is not designed or developed to be used as a production Web
server. It is basically used for conducting some of the PHP regression
tests as well as other mechanisms of unit testing. In version 4.5, it
comes up with some interesting as well as useful features for daily code
debugging jobs that are conducted from the command line.
Deprecations
The
latest version of PHP does not have a few of the older features such
has the Magic Quotes option, which are either modified in the new
version or have been dropped altogether. Again, the PHP namespace is now
exclusively reserved to deal with the native code. The E_STRICT errors,
which cover the correct usage of the object-oriented constructs as well
as deprecation warning, are now covered by E_ALL error reporting, which
will point out to each and every error, notice or warning.
Other changes and improvements
PHP
version 5.4 has also seen some other minor, not so revolutionary, yet
handy improvements that the developers will appreciate at the end of the
day.
The
latest edition has the ability of disabling the processing of POST data
for saving memory CPU cycles. In case this property is activated, it is
still possible to go and read the raw data through the input stream
path.
JsonSerializable Interface has been introduced and this will help making an object acceptable to the json_encode().
Other improvements include:
Added
callable typehint, which provides a function name, an array, composed
of an object or a classname, a closure, and a method name, for a
definite string.
Added Closure rebinding as parameter to bindTo
This
particular feature has been modified so much so that it will now accept
any other type of argument, which will define a new scope. This can
well be an object in case its class is used as class name or a scope.
Improvement in Memory and Performance
Besides,
there are quite a number of internal structures that have either been
contracted or have been altogether been eliminated and this has led to
almost 20 to 50 per cent memory savings in the larger applications. This
has also bettered the performance by 10 to 30 percent, though a series
of optimizations that include inlining of various common paths of codes.
You can hire PHP developers from PHP development company for your web development needs, who can help you build web apps within allocated budgets and time schedules.
We provide custom PHP development
services. If you would like to hire developers or would like to discuss
with our developers about your projects, please contact us at Mindfire
Solutions.
No comments:
Post a Comment