SlideShare a Scribd company logo
1 of 47
$SLIDES_SOURCES = { ‘RASMUS LERDORF’, ‘ZEEV ZURASKI’, ‘JOHN MORRIS’, };
TOPIC
WILLIAM PINAUD
NINJA PROJECT MANAGER & ARCHITECT
SLIDES ♥ AFUP LIMOGES
PHP //
NEW STUFF
AND BEYOND
Q4 2018
08/06/1995 Personal Home Page 1.0 / Forms Interpreter on Usenet
01/11/1997 PHP/FI 2.0
06/06/1998 Ze + nd - PHP: Hypertext Preprocessor - PHP 3.0 - Zend Engine 1.0
22/05/2000 PHP 4.0
14/07/2004 PHP 5.0 - Zend Engine 2.0
2005 > 2010 PHP 6.0 - ICU-based engine (RIP)
03/12/2015 PHP 7.0 - Zend Engine 3.0
20XX - PHP 8.0 - Zend Engine X.X? - JIT Compiler?
RECENTLY
Yo, what’s fresh?
83.1% Websites (W3C) and growing
PHP will survive.
PHP 7.3.0 scope ✓
PHP 7.4.0 started
PHP next version discussed
7.3.0
On the one and two and three.
Non-RFC stuff.
It’s also a project.
Dead code removal (internals)
function foo(int $x, int $y) {
$a = [$x];
$a[1] = $y;
$a = $y;
return $a;
}
PHP 7.2 PHP 7.3
foo: (lines=7, args=2, vars=3, tmps=1) foo: (lines=4, args=2, vars=3,
tmps=0)
L0: CV0($x) = RECV 1 L0: CV0($x) = RECV 1
L1: CV1($y) = RECV 2 L1: CV1($y) = RECV 2
L2: CV2($a) = INIT_ARRAY 1 CV0($x) NEXT L2: CV2($a) = QM_ASSIGN
CV1($y)
L3: ASSIGN_DIM CV2($a) int(1) L3: RETURN CV2($a)
L4: OP_DATA CV1($y)
L5: ASSIGN CV2($a) CV1($y)
L6: RETURN CV2($a)
class A { }
function foo(int $x)
{
$a = new A;
$a->foo = $x;
return $x;
}
PHP 7.3
foo: (lines=2, args=1, vars=1, tmps=0)
L0: CV0($x) = RECV 1
L1: RETURN CV0($x)
Dead code removal (internals)
function foo() {
$o = new stdClass();
$o->foo = 0;
$i = 1;
$c = $i < 2;
if ($c) {
$k = 2 * $i;
$o->foo = $i;
echo $o->foo;
}
$o->foo += 2;
$o->foo++;
return $o->foo;
}
PHP 7.3
foo: (lines=2, args=0, vars=0, tmps=0)
L0: ECHO int(1)
L1: RETURN int(4)
Indenting HEREDOC/NOWDOC
$replacement = ‘vraiment’;
// PHP 5.3+, LIMITE peut être entouré de “ ”
$heredocVar = [‘truc’, <<<LIMITE
Tiens, et si on mettait du
Lorem Ipsum, juste histoire
de se marrer un peu, parce
que $replacement c’est un truc
qu’on n’a jamais vu.
LIMITE, ‘autre truc’];
$replacement = ‘vraiment’;
// PHP 5.3+, LIMITE peut être entouré de “ ”
$heredocVar = [‘truc’, <<<LIMITE
Tiens, et si on mettait du
Lorem Ipsum, juste histoire
de se marrer un peu, parce
que $replacement c’est un truc
qu’on n’a jamais vu.
LIMITE, ‘autre truc’];
/*
Array (
[0] => “truc”,
[1] => “Tiens, et si on mettait du Lorem Ipsum, juste histoire de se marrer un peu, parce
que vraiment c’est un truc qu’on n’a jamais vu.”,
[2] => “autre truc”
)
*/
PHP 7.3 +< PHP 7.3
array_key_first()
array_key_last()
Trailing commas (,) in function calls
function foo(int $x, int $y) {
//...
}
echo foo($a, $b,);
JSON parsing error thrown
JSON_THROW_ON_ERROR
PCRE2 migration - with JIT engine
list() reference assignment
$tab = [‘Hello’, ‘AFUP’];
list($a, &$b) = $tab;
$b = ‘Limoges’;
var_dump($tab[1]); string(7) "Limoges"
is_countable()
compact() fixed
Case insensitive constants deprecation
define(‘AFUP’, ‘Limoges’, true);
// Deprecated: define(): Declaration of case-insensitive constants is deprecated
Same site cookies on the way.
7.4.0
Deeper down the rabbit hole.
Strong typing in class variables /
typed properties
class Example {
public int $scalarType;
protected ClassName $classType;
private ?ClassName $nullableClassType;
public static iterable $staticProp;
var bool $flag;
public string $str = "foo";
public ?string $nullableStr = null;
public float $x, $y;
// public float $x;
// public float $y;
}
Real-life benchmarks (master vs patch)
======================================
Master typed diff
blog 169 168 -0.77%
fw 818 809 -1.10%
qdig 716 716 +0.04%
scrum 517 502 -2.84%
ZF1 Hello 2,637 2,605 -1.23%
ZF2 Test 675 667 -1.13%
wordpress-3.6 373 368 -1.47%
drupal-7.27 560 539 -3.77%
SugarCRM 470 453 -3.68%
magento-home 90 90 +0.45%
magento-cat 30 30 -0.67%
drupal-8.0.0 860 867 +0.81%
mediawiki 114 107 -6.39%
wordpress-4.1 346 344 -0.69%
symfony_demo 661 660 -0.24%
Synthetic benchmarks (master vs patch vs patch + type hints)
===========================================================
Master typed typed+hints
empty_loop 0.026 0.026 0.026
$x = self::$x 0.090 0.118 0.117
self::$x = $n 0.086 0.094 0.108
isset(self::$x) 0.075 0.091 0.092
empty(self::$x) 0.072 0.095 0.095
$x = Foo::$x 0.069 0.081 0.079
Foo::$x = $n 0.068 0.054 0.071
isset(Foo::$x) 0.053 0.051 0.051
$x = $this->x 0.128 0.126 0.105
$this->x = $n 0.057 0.059 0.065
$this->x += 2 0.096 0.098 0.120
++$this->x 0.074 0.081 0.082
--$this->x 0.075 0.082 0.082
$this->x++ 0.075 0.083 0.082
$this->x-- 0.074 0.082 0.084
isset($this->x) 0.078 0.076 0.076
empty($this->x) 0.083 0.083 0.082
$ref = $n 0.056 0.054 0.093
Performance
Impacts?
Hash functions loaded by default
7.5.0
Why and why not.
WANT SOME MORE?
8.0.0
Enter the infinite.
AoT >> JIT?
Compilation masterminds.
FFI
Breaking the walls.
<?php
$libc = new FFI("
int printf(const char *format, ...);
const char * getenv(const char *);
unsigned int time(unsigned int *);
typedef unsigned int time_t;
typedef unsigned int suseconds_t;
struct timeval {
time_t tv_sec;
suseconds_t tv_usec;
};
struct timezone {
int tz_minuteswest;
int tz_dsttime;
};
int gettimeofday(struct timeval *tv, struct timezone *tz);
", "libc.so.6");
$libc->printf("Hello AFUP from %s!n", "Limoges");
var_dump($libc->getenv("PATH"));
var_dump($libc->time(null));
$tv = $libc->new("struct timeval");
$tz = $libc->new("struct timezone");
$libc->gettimeofday(FFI::addr($tv), FFI::addr($tz));
var_dump($tv->tv_sec, $tv->tv_usec, $tz);
?>
Hello AFUP from Limoges!
string(135) "/usr/lib64/qt-
3.3/bin:/usr/lib64/ccache:/usr/local/bin:/usr/
bin:/bin:/usr/loc"
int(1523617815)
int(1523617815)
int(977765)
object(FFICData:<struct>)#3 (2) {
["tz_minuteswest"]=>
int(-180)
["tz_dsttime"]=>
int(0)
}
<?php
$p = FFI::new("int[2]");
$p[0] = 1;
$p[1] = 2;
foreach ($p as $key => $val) {
echo "$key => $valn";
}
// “0 => 1n”
// “1 => 2n”
$pp = FFI::new("struct {int x,y;}[2]");
foreach($pp as $n => &$p) {
$p->x = $p->y = $n;
}
var_dump($pp);
object(FFICData:<struct>[2])#1 (2) {
[0]=>
object(FFICData:<struct>)#2 (2) {
["x"]=>
int(0)
["y"]=>
int(0)
}
[1]=>
object(FFICData:<struct>)#3 (2) {
["x"]=>
int(1)
["y"]=>
int(1)
}
}
?>
OpCache core
I’ve already seen that cat.
PreLoading
Did you see that coming?
Asynchronism
Legen… Wait for it. Dary. Legendary.
Merging symbols tables
Already defined, mate.
Extend instanceof
You’re my type.
Negative Index
array_keys(array_fill(-2, 4, true)); // [-2, 0, 1, 2]; - PHP 7.2.9
array_keys(array_fill(-2, 4, true)); // [-2, -1, 0, 1]; - PHP 8.0.0
Null coalesce equals?
$a = null;
$b = “test”;
$a ??= ‘yep’; // $a === ‘yep’
$b ??= ‘yep’; // $b === ‘test’
Case insensitive
constants removed
UNLESS you CARE about THAT, It’S QuIte CoOL.
Many other deletions.
Consistency fixes.
“But for those of us who’d lived and died in them furious days,
it was like everything we knew was mightily swept away.”
THANK YOU ❤
WILLIAM PINAUD
NINJA PROJECT MANAGER & ARCHITECT
SLIDES ♥ AFUP LIMOGES

More Related Content

What's hot

What's New in PHP 5.5
What's New in PHP 5.5What's New in PHP 5.5
What's New in PHP 5.5Corey Ballou
 
ZeroMQ Is The Answer
ZeroMQ Is The AnswerZeroMQ Is The Answer
ZeroMQ Is The AnswerIan Barber
 
Swiftの関数型っぽい部分
Swiftの関数型っぽい部分Swiftの関数型っぽい部分
Swiftの関数型っぽい部分bob_is_strange
 
ZeroMQ: Messaging Made Simple
ZeroMQ: Messaging Made SimpleZeroMQ: Messaging Made Simple
ZeroMQ: Messaging Made SimpleIan Barber
 
Lexical environment in ecma 262 5
Lexical environment in ecma 262 5Lexical environment in ecma 262 5
Lexical environment in ecma 262 5Kim Hunmin
 
JavaScript - Agora nervoso
JavaScript - Agora nervosoJavaScript - Agora nervoso
JavaScript - Agora nervosoLuis Vendrame
 
Créer une base NoSQL en 1 heure
Créer une base NoSQL en 1 heureCréer une base NoSQL en 1 heure
Créer une base NoSQL en 1 heureAmaury Bouchard
 
... now write an interpreter (PHPem 2016)
... now write an interpreter (PHPem 2016)... now write an interpreter (PHPem 2016)
... now write an interpreter (PHPem 2016)James Titcumb
 
Jakub Kulhán - ReactPHP + Symfony = PROFIT (1. sraz přátel Symfony v Praze)
Jakub Kulhán - ReactPHP + Symfony = PROFIT (1. sraz přátel Symfony v Praze)Jakub Kulhán - ReactPHP + Symfony = PROFIT (1. sraz přátel Symfony v Praze)
Jakub Kulhán - ReactPHP + Symfony = PROFIT (1. sraz přátel Symfony v Praze)Péhápkaři
 
Diving into HHVM Extensions (php[tek] 2016)
Diving into HHVM Extensions (php[tek] 2016)Diving into HHVM Extensions (php[tek] 2016)
Diving into HHVM Extensions (php[tek] 2016)James Titcumb
 
The Magic Of Tie
The Magic Of TieThe Magic Of Tie
The Magic Of Tiebrian d foy
 
Perl Bag of Tricks - Baltimore Perl mongers
Perl Bag of Tricks  -  Baltimore Perl mongersPerl Bag of Tricks  -  Baltimore Perl mongers
Perl Bag of Tricks - Baltimore Perl mongersbrian d foy
 
C++の話(本当にあった怖い話)
C++の話(本当にあった怖い話)C++の話(本当にあった怖い話)
C++の話(本当にあった怖い話)Yuki Tamura
 
Melhorando sua API com DSLs
Melhorando sua API com DSLsMelhorando sua API com DSLs
Melhorando sua API com DSLsAugusto Pascutti
 
Hacking Parse.y with ujihisa
Hacking Parse.y with ujihisaHacking Parse.y with ujihisa
Hacking Parse.y with ujihisaujihisa
 

What's hot (20)

What's New in PHP 5.5
What's New in PHP 5.5What's New in PHP 5.5
What's New in PHP 5.5
 
ZeroMQ Is The Answer
ZeroMQ Is The AnswerZeroMQ Is The Answer
ZeroMQ Is The Answer
 
Swiftの関数型っぽい部分
Swiftの関数型っぽい部分Swiftの関数型っぽい部分
Swiftの関数型っぽい部分
 
ZeroMQ: Messaging Made Simple
ZeroMQ: Messaging Made SimpleZeroMQ: Messaging Made Simple
ZeroMQ: Messaging Made Simple
 
Lexical environment in ecma 262 5
Lexical environment in ecma 262 5Lexical environment in ecma 262 5
Lexical environment in ecma 262 5
 
JavaScript - Agora nervoso
JavaScript - Agora nervosoJavaScript - Agora nervoso
JavaScript - Agora nervoso
 
Créer une base NoSQL en 1 heure
Créer une base NoSQL en 1 heureCréer une base NoSQL en 1 heure
Créer une base NoSQL en 1 heure
 
C++ tutorial
C++ tutorialC++ tutorial
C++ tutorial
 
Sbaw091006
Sbaw091006Sbaw091006
Sbaw091006
 
... now write an interpreter (PHPem 2016)
... now write an interpreter (PHPem 2016)... now write an interpreter (PHPem 2016)
... now write an interpreter (PHPem 2016)
 
Jakub Kulhán - ReactPHP + Symfony = PROFIT (1. sraz přátel Symfony v Praze)
Jakub Kulhán - ReactPHP + Symfony = PROFIT (1. sraz přátel Symfony v Praze)Jakub Kulhán - ReactPHP + Symfony = PROFIT (1. sraz přátel Symfony v Praze)
Jakub Kulhán - ReactPHP + Symfony = PROFIT (1. sraz přátel Symfony v Praze)
 
Diving into HHVM Extensions (php[tek] 2016)
Diving into HHVM Extensions (php[tek] 2016)Diving into HHVM Extensions (php[tek] 2016)
Diving into HHVM Extensions (php[tek] 2016)
 
The Magic Of Tie
The Magic Of TieThe Magic Of Tie
The Magic Of Tie
 
Perl Bag of Tricks - Baltimore Perl mongers
Perl Bag of Tricks  -  Baltimore Perl mongersPerl Bag of Tricks  -  Baltimore Perl mongers
Perl Bag of Tricks - Baltimore Perl mongers
 
C++の話(本当にあった怖い話)
C++の話(本当にあった怖い話)C++の話(本当にあった怖い話)
C++の話(本当にあった怖い話)
 
Perl 6 by example
Perl 6 by examplePerl 6 by example
Perl 6 by example
 
Javascript: The Important Bits
Javascript: The Important BitsJavascript: The Important Bits
Javascript: The Important Bits
 
Melhorando sua API com DSLs
Melhorando sua API com DSLsMelhorando sua API com DSLs
Melhorando sua API com DSLs
 
Php 5.6
Php 5.6Php 5.6
Php 5.6
 
Hacking Parse.y with ujihisa
Hacking Parse.y with ujihisaHacking Parse.y with ujihisa
Hacking Parse.y with ujihisa
 

Similar to PHP 8.0 Preview - What's New and Exciting Changes Coming

Debugging: Rules & Tools
Debugging: Rules & ToolsDebugging: Rules & Tools
Debugging: Rules & ToolsIan Barber
 
Debugging: Rules And Tools - PHPTek 11 Version
Debugging: Rules And Tools - PHPTek 11 VersionDebugging: Rules And Tools - PHPTek 11 Version
Debugging: Rules And Tools - PHPTek 11 VersionIan Barber
 
Introducing PHP Latest Updates
Introducing PHP Latest UpdatesIntroducing PHP Latest Updates
Introducing PHP Latest UpdatesIftekhar Eather
 
Living With Legacy Code
Living With Legacy CodeLiving With Legacy Code
Living With Legacy CodeRowan Merewood
 
Operation Oriented Web Applications / Yokohama pm7
Operation Oriented Web Applications / Yokohama pm7Operation Oriented Web Applications / Yokohama pm7
Operation Oriented Web Applications / Yokohama pm7Masahiro Nagano
 
関西PHP勉強会 php5.4つまみぐい
関西PHP勉強会 php5.4つまみぐい関西PHP勉強会 php5.4つまみぐい
関西PHP勉強会 php5.4つまみぐいHisateru Tanaka
 
PHP7 - Scalar Type Hints & Return Types
PHP7 - Scalar Type Hints & Return TypesPHP7 - Scalar Type Hints & Return Types
PHP7 - Scalar Type Hints & Return TypesEric Poe
 
Just-In-Time Compiler in PHP 8
Just-In-Time Compiler in PHP 8Just-In-Time Compiler in PHP 8
Just-In-Time Compiler in PHP 8Nikita Popov
 
TYPO3 Extension development using new Extbase framework
TYPO3 Extension development using new Extbase frameworkTYPO3 Extension development using new Extbase framework
TYPO3 Extension development using new Extbase frameworkChristian Trabold
 
PHP: The easiest language to learn.
PHP: The easiest language to learn.PHP: The easiest language to learn.
PHP: The easiest language to learn.Binny V A
 
[PL] Jak nie zostać "programistą" PHP?
[PL] Jak nie zostać "programistą" PHP?[PL] Jak nie zostać "programistą" PHP?
[PL] Jak nie zostać "programistą" PHP?Radek Benkel
 
Top 10 php classic traps DPC 2020
Top 10 php classic traps DPC 2020Top 10 php classic traps DPC 2020
Top 10 php classic traps DPC 2020Damien Seguy
 
Anatomy of a PHP Request ( UTOSC 2010 )
Anatomy of a PHP Request ( UTOSC 2010 )Anatomy of a PHP Request ( UTOSC 2010 )
Anatomy of a PHP Request ( UTOSC 2010 )Joseph Scott
 
Giới thiệu PHP 7
Giới thiệu PHP 7Giới thiệu PHP 7
Giới thiệu PHP 7ZendVN
 

Similar to PHP 8.0 Preview - What's New and Exciting Changes Coming (20)

Debugging: Rules & Tools
Debugging: Rules & ToolsDebugging: Rules & Tools
Debugging: Rules & Tools
 
Debugging: Rules And Tools - PHPTek 11 Version
Debugging: Rules And Tools - PHPTek 11 VersionDebugging: Rules And Tools - PHPTek 11 Version
Debugging: Rules And Tools - PHPTek 11 Version
 
PHP 5.4
PHP 5.4PHP 5.4
PHP 5.4
 
Introducing PHP Latest Updates
Introducing PHP Latest UpdatesIntroducing PHP Latest Updates
Introducing PHP Latest Updates
 
Having Fun Programming!
Having Fun Programming!Having Fun Programming!
Having Fun Programming!
 
Php 7 evolution
Php 7 evolutionPhp 7 evolution
Php 7 evolution
 
Living With Legacy Code
Living With Legacy CodeLiving With Legacy Code
Living With Legacy Code
 
Operation Oriented Web Applications / Yokohama pm7
Operation Oriented Web Applications / Yokohama pm7Operation Oriented Web Applications / Yokohama pm7
Operation Oriented Web Applications / Yokohama pm7
 
PHP7 Presentation
PHP7 PresentationPHP7 Presentation
PHP7 Presentation
 
What's new with PHP7
What's new with PHP7What's new with PHP7
What's new with PHP7
 
関西PHP勉強会 php5.4つまみぐい
関西PHP勉強会 php5.4つまみぐい関西PHP勉強会 php5.4つまみぐい
関西PHP勉強会 php5.4つまみぐい
 
PHP7 - Scalar Type Hints & Return Types
PHP7 - Scalar Type Hints & Return TypesPHP7 - Scalar Type Hints & Return Types
PHP7 - Scalar Type Hints & Return Types
 
Just-In-Time Compiler in PHP 8
Just-In-Time Compiler in PHP 8Just-In-Time Compiler in PHP 8
Just-In-Time Compiler in PHP 8
 
Unittests für Dummies
Unittests für DummiesUnittests für Dummies
Unittests für Dummies
 
TYPO3 Extension development using new Extbase framework
TYPO3 Extension development using new Extbase frameworkTYPO3 Extension development using new Extbase framework
TYPO3 Extension development using new Extbase framework
 
PHP: The easiest language to learn.
PHP: The easiest language to learn.PHP: The easiest language to learn.
PHP: The easiest language to learn.
 
[PL] Jak nie zostać "programistą" PHP?
[PL] Jak nie zostać "programistą" PHP?[PL] Jak nie zostać "programistą" PHP?
[PL] Jak nie zostać "programistą" PHP?
 
Top 10 php classic traps DPC 2020
Top 10 php classic traps DPC 2020Top 10 php classic traps DPC 2020
Top 10 php classic traps DPC 2020
 
Anatomy of a PHP Request ( UTOSC 2010 )
Anatomy of a PHP Request ( UTOSC 2010 )Anatomy of a PHP Request ( UTOSC 2010 )
Anatomy of a PHP Request ( UTOSC 2010 )
 
Giới thiệu PHP 7
Giới thiệu PHP 7Giới thiệu PHP 7
Giới thiệu PHP 7
 

Recently uploaded

Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...stazi3110
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfkalichargn70th171
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...gurkirankumar98700
 
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataAdobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataBradBedford3
 
XpertSolvers: Your Partner in Building Innovative Software Solutions
XpertSolvers: Your Partner in Building Innovative Software SolutionsXpertSolvers: Your Partner in Building Innovative Software Solutions
XpertSolvers: Your Partner in Building Innovative Software SolutionsMehedi Hasan Shohan
 
The Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdfThe Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdfPower Karaoke
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comFatema Valibhai
 
Project Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanationProject Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanationkaushalgiri8080
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVshikhaohhpro
 
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...soniya singh
 
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...Christina Lin
 
Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackVICTOR MAESTRE RAMIREZ
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...OnePlan Solutions
 
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdfThe Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdfkalichargn70th171
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsAlberto González Trastoy
 
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxKnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxTier1 app
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...MyIntelliSource, Inc.
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityNeo4j
 
why an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfwhy an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfjoe51371421
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxbodapatigopi8531
 

Recently uploaded (20)

Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
 
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataAdobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
 
XpertSolvers: Your Partner in Building Innovative Software Solutions
XpertSolvers: Your Partner in Building Innovative Software SolutionsXpertSolvers: Your Partner in Building Innovative Software Solutions
XpertSolvers: Your Partner in Building Innovative Software Solutions
 
The Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdfThe Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdf
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.com
 
Project Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanationProject Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanation
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
 
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
 
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
 
Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStack
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...
 
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdfThe Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
 
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxKnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered Sustainability
 
why an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfwhy an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdf
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptx
 

PHP 8.0 Preview - What's New and Exciting Changes Coming

  • 1.
  • 2. $SLIDES_SOURCES = { ‘RASMUS LERDORF’, ‘ZEEV ZURASKI’, ‘JOHN MORRIS’, }; TOPIC
  • 3. WILLIAM PINAUD NINJA PROJECT MANAGER & ARCHITECT SLIDES ♥ AFUP LIMOGES PHP // NEW STUFF AND BEYOND Q4 2018
  • 4. 08/06/1995 Personal Home Page 1.0 / Forms Interpreter on Usenet 01/11/1997 PHP/FI 2.0 06/06/1998 Ze + nd - PHP: Hypertext Preprocessor - PHP 3.0 - Zend Engine 1.0 22/05/2000 PHP 4.0 14/07/2004 PHP 5.0 - Zend Engine 2.0 2005 > 2010 PHP 6.0 - ICU-based engine (RIP) 03/12/2015 PHP 7.0 - Zend Engine 3.0 20XX - PHP 8.0 - Zend Engine X.X? - JIT Compiler?
  • 6. 83.1% Websites (W3C) and growing
  • 8. PHP 7.3.0 scope ✓ PHP 7.4.0 started PHP next version discussed
  • 9. 7.3.0 On the one and two and three.
  • 11. Dead code removal (internals) function foo(int $x, int $y) { $a = [$x]; $a[1] = $y; $a = $y; return $a; } PHP 7.2 PHP 7.3 foo: (lines=7, args=2, vars=3, tmps=1) foo: (lines=4, args=2, vars=3, tmps=0) L0: CV0($x) = RECV 1 L0: CV0($x) = RECV 1 L1: CV1($y) = RECV 2 L1: CV1($y) = RECV 2 L2: CV2($a) = INIT_ARRAY 1 CV0($x) NEXT L2: CV2($a) = QM_ASSIGN CV1($y) L3: ASSIGN_DIM CV2($a) int(1) L3: RETURN CV2($a) L4: OP_DATA CV1($y) L5: ASSIGN CV2($a) CV1($y) L6: RETURN CV2($a) class A { } function foo(int $x) { $a = new A; $a->foo = $x; return $x; } PHP 7.3 foo: (lines=2, args=1, vars=1, tmps=0) L0: CV0($x) = RECV 1 L1: RETURN CV0($x)
  • 12. Dead code removal (internals) function foo() { $o = new stdClass(); $o->foo = 0; $i = 1; $c = $i < 2; if ($c) { $k = 2 * $i; $o->foo = $i; echo $o->foo; } $o->foo += 2; $o->foo++; return $o->foo; } PHP 7.3 foo: (lines=2, args=0, vars=0, tmps=0) L0: ECHO int(1) L1: RETURN int(4)
  • 14. $replacement = ‘vraiment’; // PHP 5.3+, LIMITE peut être entouré de “ ” $heredocVar = [‘truc’, <<<LIMITE Tiens, et si on mettait du Lorem Ipsum, juste histoire de se marrer un peu, parce que $replacement c’est un truc qu’on n’a jamais vu. LIMITE, ‘autre truc’]; $replacement = ‘vraiment’; // PHP 5.3+, LIMITE peut être entouré de “ ” $heredocVar = [‘truc’, <<<LIMITE Tiens, et si on mettait du Lorem Ipsum, juste histoire de se marrer un peu, parce que $replacement c’est un truc qu’on n’a jamais vu. LIMITE, ‘autre truc’]; /* Array ( [0] => “truc”, [1] => “Tiens, et si on mettait du Lorem Ipsum, juste histoire de se marrer un peu, parce que vraiment c’est un truc qu’on n’a jamais vu.”, [2] => “autre truc” ) */ PHP 7.3 +< PHP 7.3
  • 16. Trailing commas (,) in function calls function foo(int $x, int $y) { //... } echo foo($a, $b,);
  • 17. JSON parsing error thrown JSON_THROW_ON_ERROR
  • 18. PCRE2 migration - with JIT engine
  • 20. $tab = [‘Hello’, ‘AFUP’]; list($a, &$b) = $tab; $b = ‘Limoges’; var_dump($tab[1]); string(7) "Limoges"
  • 23. Case insensitive constants deprecation define(‘AFUP’, ‘Limoges’, true); // Deprecated: define(): Declaration of case-insensitive constants is deprecated
  • 24. Same site cookies on the way.
  • 25. 7.4.0 Deeper down the rabbit hole.
  • 26. Strong typing in class variables / typed properties
  • 27. class Example { public int $scalarType; protected ClassName $classType; private ?ClassName $nullableClassType; public static iterable $staticProp; var bool $flag; public string $str = "foo"; public ?string $nullableStr = null; public float $x, $y; // public float $x; // public float $y; }
  • 28. Real-life benchmarks (master vs patch) ====================================== Master typed diff blog 169 168 -0.77% fw 818 809 -1.10% qdig 716 716 +0.04% scrum 517 502 -2.84% ZF1 Hello 2,637 2,605 -1.23% ZF2 Test 675 667 -1.13% wordpress-3.6 373 368 -1.47% drupal-7.27 560 539 -3.77% SugarCRM 470 453 -3.68% magento-home 90 90 +0.45% magento-cat 30 30 -0.67% drupal-8.0.0 860 867 +0.81% mediawiki 114 107 -6.39% wordpress-4.1 346 344 -0.69% symfony_demo 661 660 -0.24% Synthetic benchmarks (master vs patch vs patch + type hints) =========================================================== Master typed typed+hints empty_loop 0.026 0.026 0.026 $x = self::$x 0.090 0.118 0.117 self::$x = $n 0.086 0.094 0.108 isset(self::$x) 0.075 0.091 0.092 empty(self::$x) 0.072 0.095 0.095 $x = Foo::$x 0.069 0.081 0.079 Foo::$x = $n 0.068 0.054 0.071 isset(Foo::$x) 0.053 0.051 0.051 $x = $this->x 0.128 0.126 0.105 $this->x = $n 0.057 0.059 0.065 $this->x += 2 0.096 0.098 0.120 ++$this->x 0.074 0.081 0.082 --$this->x 0.075 0.082 0.082 $this->x++ 0.075 0.083 0.082 $this->x-- 0.074 0.082 0.084 isset($this->x) 0.078 0.076 0.076 empty($this->x) 0.083 0.083 0.082 $ref = $n 0.056 0.054 0.093 Performance Impacts?
  • 29. Hash functions loaded by default
  • 33. AoT >> JIT? Compilation masterminds.
  • 34.
  • 36. <?php $libc = new FFI(" int printf(const char *format, ...); const char * getenv(const char *); unsigned int time(unsigned int *); typedef unsigned int time_t; typedef unsigned int suseconds_t; struct timeval { time_t tv_sec; suseconds_t tv_usec; }; struct timezone { int tz_minuteswest; int tz_dsttime; }; int gettimeofday(struct timeval *tv, struct timezone *tz); ", "libc.so.6"); $libc->printf("Hello AFUP from %s!n", "Limoges"); var_dump($libc->getenv("PATH")); var_dump($libc->time(null)); $tv = $libc->new("struct timeval"); $tz = $libc->new("struct timezone"); $libc->gettimeofday(FFI::addr($tv), FFI::addr($tz)); var_dump($tv->tv_sec, $tv->tv_usec, $tz); ?> Hello AFUP from Limoges! string(135) "/usr/lib64/qt- 3.3/bin:/usr/lib64/ccache:/usr/local/bin:/usr/ bin:/bin:/usr/loc" int(1523617815) int(1523617815) int(977765) object(FFICData:<struct>)#3 (2) { ["tz_minuteswest"]=> int(-180) ["tz_dsttime"]=> int(0) }
  • 37. <?php $p = FFI::new("int[2]"); $p[0] = 1; $p[1] = 2; foreach ($p as $key => $val) { echo "$key => $valn"; } // “0 => 1n” // “1 => 2n” $pp = FFI::new("struct {int x,y;}[2]"); foreach($pp as $n => &$p) { $p->x = $p->y = $n; } var_dump($pp); object(FFICData:<struct>[2])#1 (2) { [0]=> object(FFICData:<struct>)#2 (2) { ["x"]=> int(0) ["y"]=> int(0) } [1]=> object(FFICData:<struct>)#3 (2) { ["x"]=> int(1) ["y"]=> int(1) } } ?>
  • 38. OpCache core I’ve already seen that cat.
  • 39. PreLoading Did you see that coming?
  • 40. Asynchronism Legen… Wait for it. Dary. Legendary.
  • 43. Negative Index array_keys(array_fill(-2, 4, true)); // [-2, 0, 1, 2]; - PHP 7.2.9 array_keys(array_fill(-2, 4, true)); // [-2, -1, 0, 1]; - PHP 8.0.0
  • 44. Null coalesce equals? $a = null; $b = “test”; $a ??= ‘yep’; // $a === ‘yep’ $b ??= ‘yep’; // $b === ‘test’
  • 45. Case insensitive constants removed UNLESS you CARE about THAT, It’S QuIte CoOL.
  • 46. Many other deletions. Consistency fixes. “But for those of us who’d lived and died in them furious days, it was like everything we knew was mightily swept away.”
  • 47. THANK YOU ❤ WILLIAM PINAUD NINJA PROJECT MANAGER & ARCHITECT SLIDES ♥ AFUP LIMOGES