7 Things You Need to Know About PHP 7

7 Things You Need to Know About PHP 7

“Hello, World,” says PHP 7.

But wait…what is PHP? To begin, it stands for “Hypertext Processor” (which is a recursive acronym, so it can be a bit confusing for newbies). It’s also a popular open source scripting language. It is well-suited for web development and can also be embedded into HTML as well, which is an homage to its usability (and subsequent popularity). If you want to learn more about the basics, check out this PHP beginner’s manual.

Enough of the basics, though, because  PHP 7 is here (and it’s anything but basic). In honor of PHP’s 7th iteration, we’ve compiled 7 of the top things you should know about the newest version.

1. First things first: What happened to PHP 6?

Well folks, PHP 6 ended up becoming PHP 5.6. After some internal arguing, people decided to skip 6 and move straight on up to 7. And now we’re here.

2. Wondering what the big deal is?

One source of the excitement is that the Zend Engine has been completely rebuilt to offer faster performance. In fact, PHP is now 2x as fast for systems like Magento and WordPress, which is good news for developers that operate on each respective platform.

Yes, the rumors are true: It’s actually even faster than HHVM (Hip-hop). Check out the official Zend infographic here. Complete with new engine updates, PHP 7 has also resulted in lower memory consumption.

3. Support for Scalar Type Hints

You can now declare type hints for scalar types! E.G.:

function foo (string $myString) {
…
}

4. It’s no Star Wars, but there are still Spaceships.

We now have the spaceship operator (<==>)

and the Null Coalescing operator ( ?? ).

5. Support for Return Types

function foo (string $myString) : string
{
  return “You entered: ” . $myString;
}

6. No More Type Casting

– intdiv() offers easy integer division, which means we can bid adieu to type casting.

$myInt = intdiv("5" / 2); 

7. Use Caution!

We hope these 7 highlights for PHP 7 have been helpful, but don’t get too excited just yet. In fact, upgrade with caution! There are breaking changes in php 7.x when migrating from 5.x.

See the official article here for full details about the new PHP launch.

Submit a Comment

Your email address will not be published. Required fields are marked *