SlideShare a Scribd company logo
PHP 7.3 AND ITS RFC
PHP 7.3 RC 6
PHP Amersfoort - November 2018
AGENDA
• PHP 7.3
• New features
• Incompatibilities
• How to migrate
• RFC
SPEAKER
• Damien Seguy
• Exakat CTO
• Static analysis for PHP
• Ik ben een boterham
PROGRAMM
• 1/8/2018 : Feature freeze
• 2/8/2018 : beta 1
• 13/09/2018 : RC1
• 13/12/2018 : 7.3.0
MAJOR EVOLUTIONS
IMPROVED GARBAGE COLLECTOR
// 20M very many objects
ms GC No GC
php54 16343.75 14306.16
php55 10654.09 6405.13
php56 10113.73 6341.04
php70 2737.26 1963.01
php71 2781.83 1881.48
php72 2281.21 1822.88
php73 2277.11 1733.06
php74 2113.07 1602.64
• 10% slower when
deactivated
• No gain for small
scripts
• More objects, 

more gain
• Most app won't use GC
IMPROVED GARBAGE COLLECTOR
<?php
$a = array();
for ($i = 0; $i < 20001000; $i++) {
    $a[$i] =& $a;
}
$a[] = "xxx";
unset($a);
var_dump(gc_collect_cycles() > 0);
echo "okn";
?>
IMPROVED GARBAGE COLLECTOR
// Some objects (2000)
ms GC No GC
php54 138.82 46.74
php55 90.47 41.35
php56 104.42 50.87
php70 105.29 47.42
php71 185.17 95.66
php72 75.31 72.98
php73 76.07 32.29
php74 70.76 37.39
• 10% slower when
deactivated
• No gain for small
scripts
• More objects, 

more gain
• Most app won't use GC
RELAXED HEREDOC/NOWDOC
<?php
class foo {
public $bar = <<<EOT
bar
EOT;
} <?php
function foo($arg) {
$bar = <<<'EOT'
bar$arg
EOT;
}
RELAXED HEREDOC/NOWDOC
<?php
class foo {
public $bar = <<<EOT
bar
EOT;
}
"bar"
• Tabulations or spaces
• Don't mix them!
RELAXED HEREDOC/NOWDOC
<?php
class foo {
public $bar = <<<EOT
bar
EOT;
}
" bar"
• Trailing comma
• Just like for arrays
• The last element may be empty
• Only applies to the last element
• Valid of methods and functions
• Targets long diffs with your VCS
TRAILING COMMA
foo(
$foo,
$bar,
$baz,
);
NO MORE CASE INSENSITIVE
CONSTANTS
namespace {
define('NSFOO', 42, true); 

// Case insensitive constant
}
 
namespace Test {
use const NSFOO;
var_dump(FOO); // OK
var_dump(foo); // Warning
}
NO MORE CASE INSENSITIVE
CONSTANTS
Case-insensitive constants are deprecated. The
correct casing for this constant is "%s
define(): Declaration of case-insensitive
constants is deprecated
• New errors
NO MORE CASE INSENSITIVE
CONSTANTS
• Conventions are to declare and use constant in
UPPER CASE
• Constants are more and more defined with const, as
class constant, and not with define()
• null, true, false will be keywords in PHP 8
• __FILE__, __LINE__, … Stay case insensitive
• Only functions are case insensitive now…
INFRASTRUCTURE
NEW SQLITE3
• Version 3.24
• Support for UPSERT
• UPSERT = INSERT or UPDATE
• An UPSERT is an ordinary INSERT statement that is
followed by the special ON CONFLICT clause
shown above.
• REPLACE = INSERT or OVERWRITE
NEW PCRE VERSION : 2.0!
• PHP 7.2 uses PCRE1
• PHP 7.3 uses PCRE2
• Lots of new features, little incompatibilities
• Options X and S are no more
• Plus de vérifications à la compilation
MINOR EVOLUTIONS
CONTINUE IS FOR LOOPS
<?php
while ($foo) {
    switch ($bar) {
        case "baz":
            continue; // In PHP: Behaves like "break;"
                      // In C:   Behaves like "continue 2;"
    }
}
?>
`"continue" targeting switch is equivalent to
"break". Did you mean to use "continue 2"?`
JSON_ENCODE RAISE
EXCEPTIONS
• json_encode/json_decode may return NULL , false,
empty string
• How to differentiate between error and valid
result?
• New option : JSON_THROW_ON_ERROR, with its
associate try{ } catch
• A new beginning…
COMPACT() REPORT UNDEFINED
VARIABLES
$foo = 'bar';
 
$baz = compact('foo', 'foz'); 

// Notice: compact(): Undefined variable: foz
NET_GET_INTERFACES()
• List all
available
network
interfaces
• Read system
information
from PHP
Array
(
[lo0] => Array
(
[unicast] => Array
(
[0] => Array
(
[flags] => 32841
[family] => 18
)
[1] => Array
(
[flags] => 32841
[family] => 30
[address] => ::1
[netmask] => ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff
)
[2] => Array
(
[flags] => 32841
[family] => 2
[address] => 127.0.0.1
[netmask] => 255.0.0.0
)
[3] => Array
(
[flags] => 32841
[family] => 30
[address] => fe80::1
[netmask] => ffff:ffff:ffff:ffff::
)
)
)
[gif0] => Array
IS_COUNTABLE()
• is_countable() checks a variable may be counted
with count()
• it may be an array or a object with Countable
HRTIME
• HRTIME is a monotonus timer
• Measures time intervals
• No impact from calendar, like microtime() : 

day light saving time, leap seconds…
• It is very precise
• More than microtime()
• Same API from microtime()
SAME SITE COOKIE
• setcookie
• setrawcookie
• session_set_cookie_params
• session_get_cookie_params
void session_set_cookie_params ( int $lifetime 

[, array $options ] )
Set-Cookie: key=value; path=/; domain=example.org;
HttpOnly; SameSite=Lax
LIST() WITH REFERENCE
$array = [1, 2];
list($a, &$b) = $array;
$array = [1, 2];
$a = $array[0];
$b =& $array[1];
LIST() WITH REFERENCE
$array = [[1, 2], [3, 4]];
foreach ($array as list(&$a, $b)) {
$a = 7;
}
var_dump($array)
REMOVED FEATURES
• image2wbmp
• but imagefromstring() supports webp
• undocumented mbstring() alias
• No more function assert()
• Search in a string with integers
FIRST KEY IN AN ARRAY
// usage of an associative array
$array = ['a' => 1, 'b' => 2, 'c' => 3];
LAST KEY IN AN ARRAY
// usage of an associative array
$array = ['a' => 1, 'b' => 2, 'c' => 3];
 
$firstKey = array_keys($array)[0];
$lastKey = array_keys($array)[count($array) - 1];
ARRAY_KEY_LAST,
ARRAY_KEY_FIRST
// usage of an associative array
$array = ['a' => 1, 'b' => 2, 'c' => 3];
 
$firstKey = array_key_first($array);
$lastKey = array_key_last($array);
 
assert($firstKey === 'a');
assert($lastKey === 'c');
VARIOUS
• No more support for BeOS
• FILTER_SANITIZE_ADD_SLASHES
Everything new with PHP 7.3
RFC
RFC : HOW DOES IT WORK?
RFC : HOW DOES IT WORK?
• Under Discussion
• In draft
• Pending Implementation
• For PHP 8.0
• PHP 7.3
• PHP 7.2…
RFC : COMMENT CA MARCHE
• Under Discussion
• In draft
• Pending Implementation
• For PHP 8.0
• PHP 7.3
• PHP 7.2…
Everything new with PHP 7.3
Everything new with PHP 7.3
Everything new with PHP 7.3
Everything new with PHP 7.3
BEDANKT!
@EXAKAT - HTTP://WWW.EXAKAT.IO/

More Related Content

PDF
The State Pattern
PDF
Elm kyivfprog 2015
PDF
Introduction to Elm
PDF
Lies, Damn Lies, and Benchmarks
PDF
Wrapping java in awesomeness aka condensator
PPT
Capistrano
PPTX
PowerShell: Automation for everyone
PDF
Selenium sandwich-3: Being where you aren't.
The State Pattern
Elm kyivfprog 2015
Introduction to Elm
Lies, Damn Lies, and Benchmarks
Wrapping java in awesomeness aka condensator
Capistrano
PowerShell: Automation for everyone
Selenium sandwich-3: Being where you aren't.

What's hot (20)

PDF
Wrangling WP_Cron - WordCamp Grand Rapids 2014
PPTX
PHP Nedir? Ne yapabiliriz?
PDF
HomeKit Inside And Out
PPT
How Danga::Socket handles asynchronous processing and how to write asynchrono...
PDF
Get your ass to 1.9
PDF
OHHttpStubs
PPTX
From Web Developer to Hardware Developer
PDF
Basic commands for powershell : Configuring Windows PowerShell and working wi...
PDF
How we migrated Zalando app to Swift3?
PDF
NSLogger network logging extension
PPT
Services Apps Iand Flex Applications
PDF
Como construir uma Aplicação que consuma e produza updates no Twitter usando ...
PDF
Cachopo - Scalable Stateful Services - Madrid Elixir Meetup
PPT
symfony & jQuery (phpDay)
PPTX
PPTX
PDF
Serverless Ballerina
PDF
CouchDB: A NoSQL database
KEY
Mojo as a_client
PDF
DIG1108C Lesson3 Fall 2014
Wrangling WP_Cron - WordCamp Grand Rapids 2014
PHP Nedir? Ne yapabiliriz?
HomeKit Inside And Out
How Danga::Socket handles asynchronous processing and how to write asynchrono...
Get your ass to 1.9
OHHttpStubs
From Web Developer to Hardware Developer
Basic commands for powershell : Configuring Windows PowerShell and working wi...
How we migrated Zalando app to Swift3?
NSLogger network logging extension
Services Apps Iand Flex Applications
Como construir uma Aplicação que consuma e produza updates no Twitter usando ...
Cachopo - Scalable Stateful Services - Madrid Elixir Meetup
symfony & jQuery (phpDay)
Serverless Ballerina
CouchDB: A NoSQL database
Mojo as a_client
DIG1108C Lesson3 Fall 2014
Ad

Similar to Everything new with PHP 7.3 (20)

DOCX
Guidelines php 8 gig
PDF
All you need to know about latest php version 7.4
PPTX
20 cool features that is in PHP 7, we missed in PHP 5. Let walkthrough with t...
ODP
Is your code ready for PHP 7 ?
PPTX
Learning php 7
PDF
Preparing code for Php 7 workshop
PDF
Last 2 Months in PHP - July & August 2016
PDF
Php 5.6 From the Inside Out
ODP
The why and how of moving to php 7.x
ODP
The why and how of moving to php 7.x
PDF
Php In A Nutshell A Desktop Quick Reference 1st Edition Paul Hudson
PPT
PHP 5.3 Part 1 - Introduction to PHP 5.3
PDF
Php 7 compliance workshop singapore
PDF
Php interview-questions and answers
PDF
08 Advanced PHP #burningkeyboards
PPTX
Peek at PHP 7
PDF
The why and how of moving to php 8
PDF
Start using PHP 7
PDF
php_ebook.pdf
Guidelines php 8 gig
All you need to know about latest php version 7.4
20 cool features that is in PHP 7, we missed in PHP 5. Let walkthrough with t...
Is your code ready for PHP 7 ?
Learning php 7
Preparing code for Php 7 workshop
Last 2 Months in PHP - July & August 2016
Php 5.6 From the Inside Out
The why and how of moving to php 7.x
The why and how of moving to php 7.x
Php In A Nutshell A Desktop Quick Reference 1st Edition Paul Hudson
PHP 5.3 Part 1 - Introduction to PHP 5.3
Php 7 compliance workshop singapore
Php interview-questions and answers
08 Advanced PHP #burningkeyboards
Peek at PHP 7
The why and how of moving to php 8
Start using PHP 7
php_ebook.pdf
Ad

More from Damien Seguy (20)

PDF
Strong typing @ php leeds
PPTX
Strong typing : adoption, adaptation and organisation
PDF
Qui a laissé son mot de passe dans le code
PDF
Analyse statique et applications
PDF
Top 10 pieges php afup limoges
PDF
Top 10 php classic traps DPC 2020
PDF
Meilleur du typage fort (AFUP Day, 2020)
PDF
Top 10 php classic traps confoo
PDF
Tout pour se préparer à PHP 7.4
PDF
Top 10 php classic traps php serbia
PDF
Top 10 php classic traps
PDF
Top 10 chausse trappes
PDF
Code review workshop
PDF
Understanding static analysis php amsterdam 2018
PDF
Review unknown code with static analysis php ce 2018
PDF
Php 7.3 et ses RFC (AFUP Toulouse)
PDF
Tout sur PHP 7.3 et ses RFC
PDF
Review unknown code with static analysis php ipc 2018
PDF
Code review for busy people
PDF
Static analysis saved my code tonight
Strong typing @ php leeds
Strong typing : adoption, adaptation and organisation
Qui a laissé son mot de passe dans le code
Analyse statique et applications
Top 10 pieges php afup limoges
Top 10 php classic traps DPC 2020
Meilleur du typage fort (AFUP Day, 2020)
Top 10 php classic traps confoo
Tout pour se préparer à PHP 7.4
Top 10 php classic traps php serbia
Top 10 php classic traps
Top 10 chausse trappes
Code review workshop
Understanding static analysis php amsterdam 2018
Review unknown code with static analysis php ce 2018
Php 7.3 et ses RFC (AFUP Toulouse)
Tout sur PHP 7.3 et ses RFC
Review unknown code with static analysis php ipc 2018
Code review for busy people
Static analysis saved my code tonight

Recently uploaded (20)

PPT
“AI and Expert System Decision Support & Business Intelligence Systems”
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PDF
KodekX | Application Modernization Development
PDF
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
PDF
Unlocking AI with Model Context Protocol (MCP)
PPTX
MYSQL Presentation for SQL database connectivity
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PDF
Electronic commerce courselecture one. Pdf
PPTX
sap open course for s4hana steps from ECC to s4
PDF
cuic standard and advanced reporting.pdf
PDF
MIND Revenue Release Quarter 2 2025 Press Release
PPTX
Cloud computing and distributed systems.
PPTX
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PPT
Teaching material agriculture food technology
“AI and Expert System Decision Support & Business Intelligence Systems”
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
The Rise and Fall of 3GPP – Time for a Sabbatical?
20250228 LYD VKU AI Blended-Learning.pptx
KodekX | Application Modernization Development
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
Unlocking AI with Model Context Protocol (MCP)
MYSQL Presentation for SQL database connectivity
Dropbox Q2 2025 Financial Results & Investor Presentation
Electronic commerce courselecture one. Pdf
sap open course for s4hana steps from ECC to s4
cuic standard and advanced reporting.pdf
MIND Revenue Release Quarter 2 2025 Press Release
Cloud computing and distributed systems.
Detection-First SIEM: Rule Types, Dashboards, and Threat-Informed Strategy
NewMind AI Weekly Chronicles - August'25 Week I
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
Agricultural_Statistics_at_a_Glance_2022_0.pdf
Teaching material agriculture food technology

Everything new with PHP 7.3

  • 1. PHP 7.3 AND ITS RFC PHP 7.3 RC 6 PHP Amersfoort - November 2018
  • 2. AGENDA • PHP 7.3 • New features • Incompatibilities • How to migrate • RFC
  • 3. SPEAKER • Damien Seguy • Exakat CTO • Static analysis for PHP • Ik ben een boterham
  • 4. PROGRAMM • 1/8/2018 : Feature freeze • 2/8/2018 : beta 1 • 13/09/2018 : RC1 • 13/12/2018 : 7.3.0
  • 6. IMPROVED GARBAGE COLLECTOR // 20M very many objects ms GC No GC php54 16343.75 14306.16 php55 10654.09 6405.13 php56 10113.73 6341.04 php70 2737.26 1963.01 php71 2781.83 1881.48 php72 2281.21 1822.88 php73 2277.11 1733.06 php74 2113.07 1602.64 • 10% slower when deactivated • No gain for small scripts • More objects, 
 more gain • Most app won't use GC
  • 8. IMPROVED GARBAGE COLLECTOR // Some objects (2000) ms GC No GC php54 138.82 46.74 php55 90.47 41.35 php56 104.42 50.87 php70 105.29 47.42 php71 185.17 95.66 php72 75.31 72.98 php73 76.07 32.29 php74 70.76 37.39 • 10% slower when deactivated • No gain for small scripts • More objects, 
 more gain • Most app won't use GC
  • 9. RELAXED HEREDOC/NOWDOC <?php class foo { public $bar = <<<EOT bar EOT; } <?php function foo($arg) { $bar = <<<'EOT' bar$arg EOT; }
  • 10. RELAXED HEREDOC/NOWDOC <?php class foo { public $bar = <<<EOT bar EOT; } "bar"
  • 11. • Tabulations or spaces • Don't mix them! RELAXED HEREDOC/NOWDOC <?php class foo { public $bar = <<<EOT bar EOT; } " bar"
  • 12. • Trailing comma • Just like for arrays • The last element may be empty • Only applies to the last element • Valid of methods and functions • Targets long diffs with your VCS TRAILING COMMA foo( $foo, $bar, $baz, );
  • 13. NO MORE CASE INSENSITIVE CONSTANTS namespace { define('NSFOO', 42, true); 
 // Case insensitive constant }   namespace Test { use const NSFOO; var_dump(FOO); // OK var_dump(foo); // Warning }
  • 14. NO MORE CASE INSENSITIVE CONSTANTS Case-insensitive constants are deprecated. The correct casing for this constant is "%s define(): Declaration of case-insensitive constants is deprecated • New errors
  • 15. NO MORE CASE INSENSITIVE CONSTANTS • Conventions are to declare and use constant in UPPER CASE • Constants are more and more defined with const, as class constant, and not with define() • null, true, false will be keywords in PHP 8 • __FILE__, __LINE__, … Stay case insensitive • Only functions are case insensitive now…
  • 17. NEW SQLITE3 • Version 3.24 • Support for UPSERT • UPSERT = INSERT or UPDATE • An UPSERT is an ordinary INSERT statement that is followed by the special ON CONFLICT clause shown above. • REPLACE = INSERT or OVERWRITE
  • 18. NEW PCRE VERSION : 2.0! • PHP 7.2 uses PCRE1 • PHP 7.3 uses PCRE2 • Lots of new features, little incompatibilities • Options X and S are no more • Plus de vérifications à la compilation
  • 20. CONTINUE IS FOR LOOPS <?php while ($foo) {     switch ($bar) {         case "baz":             continue; // In PHP: Behaves like "break;"                       // In C:   Behaves like "continue 2;"     } } ?> `"continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"?`
  • 21. JSON_ENCODE RAISE EXCEPTIONS • json_encode/json_decode may return NULL , false, empty string • How to differentiate between error and valid result? • New option : JSON_THROW_ON_ERROR, with its associate try{ } catch • A new beginning…
  • 22. COMPACT() REPORT UNDEFINED VARIABLES $foo = 'bar';   $baz = compact('foo', 'foz'); 
 // Notice: compact(): Undefined variable: foz
  • 23. NET_GET_INTERFACES() • List all available network interfaces • Read system information from PHP Array ( [lo0] => Array ( [unicast] => Array ( [0] => Array ( [flags] => 32841 [family] => 18 ) [1] => Array ( [flags] => 32841 [family] => 30 [address] => ::1 [netmask] => ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff ) [2] => Array ( [flags] => 32841 [family] => 2 [address] => 127.0.0.1 [netmask] => 255.0.0.0 ) [3] => Array ( [flags] => 32841 [family] => 30 [address] => fe80::1 [netmask] => ffff:ffff:ffff:ffff:: ) ) ) [gif0] => Array
  • 24. IS_COUNTABLE() • is_countable() checks a variable may be counted with count() • it may be an array or a object with Countable
  • 25. HRTIME • HRTIME is a monotonus timer • Measures time intervals • No impact from calendar, like microtime() : 
 day light saving time, leap seconds… • It is very precise • More than microtime() • Same API from microtime()
  • 26. SAME SITE COOKIE • setcookie • setrawcookie • session_set_cookie_params • session_get_cookie_params void session_set_cookie_params ( int $lifetime 
 [, array $options ] ) Set-Cookie: key=value; path=/; domain=example.org; HttpOnly; SameSite=Lax
  • 27. LIST() WITH REFERENCE $array = [1, 2]; list($a, &$b) = $array; $array = [1, 2]; $a = $array[0]; $b =& $array[1];
  • 28. LIST() WITH REFERENCE $array = [[1, 2], [3, 4]]; foreach ($array as list(&$a, $b)) { $a = 7; } var_dump($array)
  • 29. REMOVED FEATURES • image2wbmp • but imagefromstring() supports webp • undocumented mbstring() alias • No more function assert() • Search in a string with integers
  • 30. FIRST KEY IN AN ARRAY // usage of an associative array $array = ['a' => 1, 'b' => 2, 'c' => 3];
  • 31. LAST KEY IN AN ARRAY // usage of an associative array $array = ['a' => 1, 'b' => 2, 'c' => 3];   $firstKey = array_keys($array)[0]; $lastKey = array_keys($array)[count($array) - 1];
  • 32. ARRAY_KEY_LAST, ARRAY_KEY_FIRST // usage of an associative array $array = ['a' => 1, 'b' => 2, 'c' => 3];   $firstKey = array_key_first($array); $lastKey = array_key_last($array);   assert($firstKey === 'a'); assert($lastKey === 'c');
  • 33. VARIOUS • No more support for BeOS • FILTER_SANITIZE_ADD_SLASHES
  • 35. RFC
  • 36. RFC : HOW DOES IT WORK?
  • 37. RFC : HOW DOES IT WORK? • Under Discussion • In draft • Pending Implementation • For PHP 8.0 • PHP 7.3 • PHP 7.2…
  • 38. RFC : COMMENT CA MARCHE • Under Discussion • In draft • Pending Implementation • For PHP 8.0 • PHP 7.3 • PHP 7.2…