Slide 1

Slide 1 text

Juliette Reinders Folmer @jrf_nl Essential PHP 7

Slide 2

Slide 2 text

No content

Slide 3

Slide 3 text

What Happened to PHP 6 ? • Unicode – ICU • Publications

Slide 4

Slide 4 text

No content

Slide 5

Slide 5 text

No content

Slide 6

Slide 6 text

How Fast ?!?!?

Slide 7

Slide 7 text

How Fast ?!?!?

Slide 8

Slide 8 text

How Fast ?!?!?

Slide 9

Slide 9 text

What Can You Expect ? New features! Less BC breaks than upgrading to 5.4! PHPNG (PHP Next-Gen) Speed !

Slide 10

Slide 10 text

When ? 7.0: December 3, 2015 Current: 7.0.13 7.1: ~November 2016 Currently on RC6

Slide 11

Slide 11 text

Version Support Today: November 16 2016

Slide 12

Slide 12 text

PHP 5.2 PHP 5.3 PHP 5.4 PHP 5.5 Requirements PHP 5.6

Slide 13

Slide 13 text

What has changed ?

Slide 14

Slide 14 text

So Long And Thanks For All The Fish MySql & MsSql extensions Ereg Posix Regex PHP 5.5 and lower

Slide 15

Slide 15 text

• dl() on fpm-fcgi • set_magic_quotes_runtime() • set_socket_blocking() • mcrypt_generic_end() • mcrypt_ecb() • mcrypt_cnc() • mcrypt_cfb() • datefmt_set_timezone_id • IntlDateFormatter::setTimeZoneID • call_user_method() • call_user_method_array() Removed Functions

Slide 16

Slide 16 text

• xsl.security_prefs • Input encoding: – iconv.input_encoding – Iconv.internal_encoding – mbstring.http_input – mbstring.http_output – mbstring.internal_encoding Removed ini Options

Slide 17

Slide 17 text

What Will Break ? Alternative PHP tags echo 'script tags'; <% echo 'ASP tags'; %>

Slide 18

Slide 18 text

What Will Break ? Numeric Hex strings Alternative PHP tags

Slide 19

Slide 19 text

What Will Break ? Multiple default: Division by zero Numeric Hex strings Alternative PHP tags

Slide 20

Slide 20 text

What Will Break ? Static vs $this property; } } MyClass::example();

Slide 21

Slide 21 text

What Will Break ? preg_replace /e Static vs $this new ... by reference Some Variable Variables

Slide 22

Slide 22 text

Uniform Variable Syntax Syntax Old Interpretation New Interpretation $$var[‘key1’][‘key2’] ${$var[‘key1’][‘key2’]} ($$var)[‘key1’][‘key2’] $var->$prop[‘key’] $var->{$prop[‘key’]} ($var->$prop)[‘key’] $var->$prop[‘key’]() $var->{$prop[‘key’]}() ($var->$prop)[‘key’]() Class::$var[‘key’]() Class::{$var[‘key’]}() (Class::$var)[‘key’]()

Slide 23

Slide 23 text

What Will Break ? $HTTP_ RAW_ POST_ DATA Invalid octal literals list() vs string access Redefining function args

Slide 24

Slide 24 text

What Will Break ? PHP4 construc- tors

Slide 25

Slide 25 text

PHP4 Constructors

Slide 26

Slide 26 text

PHP4 Constructors

Slide 27

Slide 27 text

PHP4 Constructors

Slide 28

Slide 28 text

What Will Break ? func_get_ args() PHP4 construc- tors

Slide 29

Slide 29 text

What Will Break ? func_get_ args() Reserved words PHP4 construc- tors

Slide 30

Slide 30 text

What Will Break ? func_get_ args() Reserved words PHP4 construc- tors Internal array pointer vs foreach()

Slide 31

Slide 31 text

Being Forward Compatible can be as Important as Being Backwards Compatible

Slide 32

Slide 32 text

Cross-version bootstrap.php version_compare() function_exists() class_exists() method_exists() defined()  class-php53-code.php  class-php70-code.php  class-php-compat.php

Slide 33

Slide 33 text

About Shims

Slide 34

Slide 34 text

When to Use Shims ? Framework Implement early Load early Feature complete

Slide 35

Slide 35 text

No content

Slide 36

Slide 36 text

In 2020..... (or thereabouts)

Slide 37

Slide 37 text

PHP5.3+ on Steriods Bind Closure on Call Group Use Declarations Anonymous Classes Generator Enhancements Assertions

Slide 38

Slide 38 text

Goodies! Spaceship Unicode Escapes Strict Typing More Exception Types More Catchable Errors Uniform Variable Syntax Null Coalesce Scalar Type Hints & Return Type Hints

Slide 39

Slide 39 text

More Goodies! Session options Preg_ replace_ callback_ array() intdiv() Expectations Closure call() Filtered unserialize() Exceptions on Fatals IntlChar Class

Slide 40

Slide 40 text

PHP 7.1 Goodies! List with keys Multi catch iterable type hint Symmetric array destructuring void return type Nullable types Negative string offset support Class constant visibility

Slide 41

Slide 41 text

No content

Slide 42

Slide 42 text

• PHP 7 Compatibility Checker – https://github.com/sstalle/php7cc • PHP Compatibility Code Standard – https://github.com/wimg/PHPCompatibility/ • PHP CompatInfo – http://php5.laurent-laville.org/compatinfo/ Check Your Application

Slide 43

Slide 43 text

• Are the PHP Extensions Ready ? – https://github.com/gophp7/gophp7-ext/wiki/extensions- catalog • Need a Dev Box ? – https://github.com/rlerdorf/php7dev • PHP 7 to PHP 5.6 transphiler – https://github.com/jaytaph/Transphpile • PHP Cheatsheets – http://phpcheatsheets.com/ Useful

Slide 44

Slide 44 text

Slides will be posted to http://speakerdeck.com/jrf Please give feedback at https://joind.in/talk/aedbe Thank you ! Essential PHP 7