SlideShare una empresa de Scribd logo
1 de 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

Más contenido relacionado

La actualidad más candente

Lexical environment in ecma 262 5
Lexical environment in ecma 262 5Lexical environment in ecma 262 5
Lexical environment in ecma 262 5
Kim Hunmin
 
Hacking Parse.y with ujihisa
Hacking Parse.y with ujihisaHacking Parse.y with ujihisa
Hacking Parse.y with ujihisa
ujihisa
 

La actualidad más candente (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 a PHP in 2018 - Q4 - AFUP Limoges

Introducing PHP Latest Updates
Introducing PHP Latest UpdatesIntroducing PHP Latest Updates
Introducing PHP Latest Updates
Iftekhar Eather
 
Operation Oriented Web Applications / Yokohama pm7
Operation Oriented Web Applications / Yokohama pm7Operation Oriented Web Applications / Yokohama pm7
Operation Oriented Web Applications / Yokohama pm7
Masahiro Nagano
 
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
 

Similar a PHP in 2018 - Q4 - AFUP Limoges (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
 

Último

CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female serviceCALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
anilsa9823
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
anilsa9823
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
Health
 

Último (20)

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
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
 
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female serviceCALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
CALL ON ➥8923113531 🔝Call Girls Badshah Nagar Lucknow best Female service
 
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
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docx
 
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AISyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial Goals
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.js
 
Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Models
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptx
 
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
 
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
 
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS LiveVip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
 

PHP in 2018 - Q4 - AFUP Limoges

  • 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