Back Button PHP
What's New in PHP 7.1

What's New in PHP 7.1

Though not as flashy as the long-in-development 7.0 release, PHP 7.1 nonetheless brings with it a number of useful features, ranging from short array destructuring, to negative string offsets, to improved return types. Come along, as we review what's new in PHP!
Beginner
5 episodes
19:57 mins
5
Latest Episode in This Series

Added 3 years ago

Iterables

New to PHP 7.1 is a new iterable pseudo-type. If you're currently type-hinting array all over the...

Watch
What's New in PHP 7.1

What's New in PHP 7.1

Though not as flashy as the long-in-development 7.0 release, PHP 7.1 nonetheless brings with it a number of useful features, ranging from short array destructuring, to negative string offsets, to improved return types. Come along, as we review what's new in PHP!
Begin
5
Latest Episode in This Series

Added 3 years ago

Iterables

New to PHP 7.1 is a new iterable pseudo-type. If you're currently type-hinting array all over the...

Watch
  • Beginner
    5 episodes
    19:57 mins

Your Teacher | Jeffrey Way

https://laracasts.s3.amazonaws.com/avatars/jeffrey-avatar.jpg's avatar
Hi, I'm Jeffrey. I'm the creator of Laracasts and spend most of my days building the site and thinking of new ways to teach confusing concepts. I live in Orlando, Florida with my wife and two kids.
    1. EPISODE 1

      Run Time 3:09

      Free

      Before we can toy around with the new additions to PHP 7.1, we must first install it. In the past, this was always a pain in the neck to accomplish; however, these days, we only need to pull in Rasmus' Vagrant image to get up and running as quickly as possible.

    2. EPISODE 2

      Run Time 4:30

      Free

      First up, we have symmetric array destructuring: an incredibly confusing term for a simple concept: we can now use the short array syntax to translate (or destructure) any array - both indexed and associative - into a list of variables.

    3. EPISODE 3

      Run Time 6:18

      Free

      Nullable and void types are both new to PHP 7.1. Should you desire to, you may now mark a typehint or return type as being nullable, simply by prefixing it with a question mark. This indicates that you expect either the given type, or null. Additionally, the ability to specify a void return type is now available.

    4. EPISODE 4

      Run Time 2:11

      Free

      Often, you'll find yourself catching and responding to multiple exception types with the exact same logic. In PHP 7.1, however, you may now remove this duplication by separating each exception type with a pipe (catch (ChargeFailed | InsufficientFunds $e)).

    5. EPISODE 5

      Run Time 3:49

      Free

      New to PHP 7.1 is a new iterable pseudo-type. If you're currently type-hinting array all over the place, think about it: would you be that upset if the user instead passed an object that can be iterated over? Of course not. This new pseudo-type solves that!