PHP 7.1 is out!
- CentOS and Friends (including Amazon Linux)
- https://blog.remirepo.net/post/2016/12/05/Install-PHP-7.1-on-CentOS-RHEL-or-Fedora (Remi)
- ius has php71u and associated
- Debian-based (Ubuntu etc.)
- https://launchpad.net/~ondrej/+archive/ubuntu/php
- Dotdeb doesn't have 7.1 yet
- MacOS (fka OS X)
- brew has php71
- https://php-osx.liip.ch/
- http://windows.php.net/download#php-7.1
Nullable Types
function get(?int $id) : ?MyObject { // return either a MyObject or null }
ArgumentCountError?!?
- When too few arguments are passed to a call
- Used to be a Warning
- Is now an Error (catchable)
- If your code has this issue, 7.1 is a BC break for you
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] = returnsAnArray(); foreach (arrayOfArrays() as [$first, $second]) {}
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!
PHP 7.1 in 10 minutes
By Ian Littman
PHP 7.1 in 10 minutes
- 2,510