What's New in PHP Web Development?

March 23, 2017

PHP is everywhere, with estimates saying that, of the server-side language that is known, 82.6% of websites use PHP and about 95.3% of those are using PHP 5 according to W3Techs. It’s been 23 years since PHP was born, and we’re now at version 7.1.3. Tweaks and changes along the way are working to enhance performance (i.e., speed) and make coding more precise and efficient. If you’re part of the group that is still in earlier versions, it may be time to move up to PHP 7. And no, you didn’t miss 6. One of PHP’s core developers Andrei Zmievski wanted to bring native Unicode support to the language by embedding the ICU library and internally representing strings as UTF-16. Because this project would lead to major internal and user-affecting changes, it was planned to be the next version, PHP 6. However, using UTF-16 as default encoding takes a lot of time and memory, and many developers turned to the 5.2/5.3 branches or didn’t use it at all. This caused a delay in the project and since much was already written about 6, it was decided by vote in 2014 to move on to version 7.

Now that we’re a few versions into 7, let’s take a look at some of the features.

 

Nullable Types

Now you can specifically declare nullable types which allows you to make the intent clear of what you are planning to do with variables or functions which makes the code easy to understand. It also enables error handling in a better way.   

Void Function

In earlier versions, it was expected that every function is returning something of some value, but void function allows you to write functions that are logical implementations of something and not return any value. The advantage of a void function is that it’s clear that you aren’t expecting anything from it which makes error handling better. Most programming languages already have void function and now PHP is up to speed in that regard.

Symmetric Array Destructuring

You can now use square bracket syntax to access elements that you would previously do with a list function. The advantage is you can directly loop to any variables without having to use list function. You can also use indexes in the square bracket syntax to map key value array easily. This makes the code more precise and concise. 

Iterable Pseudo-type

In addition to many data types, the Iterable pseudo-type allows you to specify that the elements can be iterate inside of a function. This allows for better error handling because you know exactly what type of data that you are getting.    

Multi-Catch Exception Handling

With this new feature, you can add multiple catchers which allows you to catch multiple errors, syntax, or exceptions. This enables you to be more efficient and it makes debugging easier. 

Support for Negative String Offsets

In earlier versions of PHP, it didn’t allow negative offsets, you could use only positive integers. Now you can specify negative offsets so that you can grab what you want with more precision.

Convert Callables to Closures

The benefit of callables to Closures is that you can grab errors where they are happening instead of where they are being called. This allows for completing the transaction without leaving anything in the global scope.

Asynchronous Signal Handling

Most people don’t usually get to this level, but if you do just know that this is a trigger that doesn’t interrupt the flow of the script. This was done previously with ticks, but it was resource heavy.

HTTP/2 Server Push Support in ext/curl

This enhancement will decrease page load times to First Byte since with HTTP/2 the server can detect assets and requests and push them all at once.

Ready to make the move to version 7? If you’re still in version 5, the jump may be a big one, but will be well worth it. Support for 5.5 has ended so now is the time. PHP is gearing up to compete with the other languages, and you’ll want to experience all of the new features that make development enjoyable.

Please contact us if you are interested in exploring how to form an effective digital strategy and execute that strategy with an experienced web development firm.

Located near Washington, DC, in Alexandria, VA, New Target provides digital strategy, web design, web development, data integration, application hosting, and online search engine marketing for prominent national associations, corporations, and government agencies nationwide.

Latest News

June 20, 2017

The premier Washington DC Drupal web development conference is happening soon! New Target is pleased to sponsor the conference once again as a...Read more

June 9, 2017

Community of Hope is based in Washington, D.C. and provides services to homeless and low-income individuals and families, including transitional...Read more

May 24, 2017

Had a bad website experience?  Can’t find what you need on a website? Sending off an email through a web form or clicking to chat can...Read more

Work With Us

New fieldset
New fieldset
CAPTCHA
This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.
815 North Royal Street
Suites 100 & 204
Alexandria, Virginia 22314

703.548.3433 (Office)
703.548.5032 (Fax)

web@newtarget.com