PHP 7.1 in 5 minutes

Ian Littman / @iansltx

Nullable Types

function get(?int $id) : ?MyObject {
    // return either a MyObject or null
}

Class Constant Visibility

class MyObject
{
    protected const SECRET = "yoloswag";
}

Void Return Types

function executeAThing() : void
{
    // doesn't return anything
}

Short List Syntax

[$a, $b, $c] = returnsAThreeLengthArray();

iterable pseudo-type

function doAThingOnASet(iterable $set)
{
    // foreach over a thing
    // array or Traversable
}

Gotta catch 'em all

try {
    // do something risky
} catch (BadThing | BlackSwanEvent $e) {
    // handle these exception types
}

Closure::fromCallable()

$strlenIsNowAClosure = 
    Closure::fromCallable('strlen');

...and more!

  • Async pcntl handling
  • HTTP/2 Server Push support in cURL
  • AEAD in OpenSSL
  • Negative string offset support in more places
  • Edge case cleanup
  • ...and more!

Thanks!

PHP 7.1 in 5 minutes

By Ian Littman

PHP 7.1 in 5 minutes

  • 706
Loading comments...

More from Ian Littman