SlideShare a Scribd company logo
1 of 47
Download to read offline
PHP 7.4
Andrea Maccis
andrea.maccis@gmail.com
WHAT’S NEW IN
WHAT’S NEW IN PHP 7.4
SOURCES
‣ Brent Roose - What's new in PHP 7.4
‣ Carlo Daniele - What's new in PHP 7.4 (Features,
Deprecations, Speed)
‣ RFCs PHP 7.4
‣ Brent Roose - Preloading in PHP 7.4
‣ David Shafik - PHP Performance I: Everything You Need to
Know About OpCode Caches
WHAT’S NEW IN PHP 7.4
RELEASE TIMELINE
▸ 13/6/19 - 7.4 Alpha1
▸ 25/7/19 - 7.4 Beta1
▸ 5/9/19 - 7.4 RC1
▸ …[RC2, RC3, RC4, RC5]
▸ 14/11/19 - 7.4 RC6
▸ 28/11/19 - 7.4 GA
▸ 18/12/19 - 7.4.1
NEW FEATURES
LET’S SEE SOME
ARRAY SPREAD OPERATOR
WHAT’S NEW IN PHP 7.4 - FEATURES
ARRAY SPREAD OPERATOR
‣ An array pair prefixed by … will be expanded in places
during array definition
WHAT’S NEW IN PHP 7.4 - FEATURES
ARRAY SPREAD OPERATOR (ERRORS)
‣ In order to make the behavior consistent with argument
unpacking, string keys are not supported
‣ It’s not possible to unpack an array by reference
PRELOADING
WHAT’S NEW IN PHP 7.4 - FEATURES
PHP LIFECYCLE
WHAT’S NEW IN PHP 7.4 - FEATURES
PHP LIFECYCLE
WHAT’S NEW IN PHP 7.4 - FEATURES
PRELOADING
‣ Preloading is controlled by just a single new php.ini directive: opcache.preload
‣ Using this directive we will specify a single PHP file which will perform the
preloading task
‣ Once loaded, this file is then fully executed - and may preload other files, either
by including them or by using the opcache_compile_file() function at module
initialization
‣ Preloaded files remain cached in opcache memory forever, modification of their
corresponding source files won’t have any effect without another server restart
‣ In order for files to be preloaded, their dependencies (interfaces, parent classes
and traits) must be preloaded too
WHAT’S NEW IN PHP 7.4 - FEATURES
PRELOADING (SYMFONY 4.4)
‣ Symfony 4.4 can generate a preloading file for your
application in the cache directory, that includes both the
environment and and kernel names:
/path/to/project/var/cache/prod/App_KernelProdContainer.preload.php
WHAT’S NEW IN PHP 7.4 - FEATURES
PRELOADING (PERFORMANCES)
‣ You could decide to only preload “hot classes” (classes
that are used often in your codebase
‣ Benjamin Morel’s benchmark shows that only loading
around 100 hot classes, actually yields better performance
gains than preloading everything (13% to 17%
performance increase)
WHAT’S NEW IN PHP 7.4 - FEATURES
WITH PRELOADING (BACKWARD COMPATIBILITY)
‣ Since preloaded classes and functions are always
available, function_exists() and class_exists() always
return TRUE
‣ Incorrect usage on a server with more than one app could
result in failures; as different apps (or different versions of
the same app) may have the same class/function names in
different files, so if one version of the class is preloaded it
will prevent loading of any other version of that class
defined in a different file
COVARIANT RETURNS AND
CONTRAVARIANT PARAMETERS
WHAT’S NEW IN PHP 7.4 - FEATURES
VARIANCE
Within the type system, a typing rule or a type constructor is:
‣ covariant if it preserves the ordering of types (from more
specific to more generic)
e.g. Cat() is an Animal()
‣ contravariant if it reverses this ordering
e.g. an Animal() is a Cat()
‣ variant if covariant or contravariant
‣ invariant if neither of these applies
WHAT’S NEW IN PHP 7.4 - FEATURES
WITHOUT COVARIANT RETURNS AND CONTRAVARIANT PARAMETERS
‣ Until 7.3, PHP had mostly invariant return types and did not permit choosing
less specific parameter types or more specific return types even though these
substitutions were type-safe
WHAT’S NEW IN PHP 7.4 - FEATURES
WITH COVARIANT RETURNS AND CONTRAVARIANT PARAMETERS
ARROW FUNCTIONS 2.0
WHAT’S NEW IN PHP 7.4 - FEATURES
WITHOUT ARROW FUNCTIONS 2.0
‣ Anonymous functions in PHP can be quite verbose and
partly this is due to the need to manually import used
variables
WHAT’S NEW IN PHP 7.4 - FEATURES
WITH ARROW FUNCTIONS 2.0
‣ When a variable used in the expression is defined in the
parent scope it will be implicitly captured by-value
WHAT’S NEW IN PHP 7.4 - FEATURES
WITH ARROW FUNCTIONS 2.0
WHAT’S NEW IN PHP 7.4 - FEATURES
ARROW FUNCTIONS 2.0 (BACKWARD COMPATIBILITY)
Unfortunately the fn keyword must be a full keyword and not
just a reserved function name
FOREIGN FUNCTION INTERFACE
WHAT’S NEW IN PHP 7.4 - FEATURES
FOREIGN FUNCTION INTERFACE
‣ FFI opens a way to write PHP extensions and bindings to C
libraries in pure PHP.
NULL COALESCING ASSIGNMENT
OPERATOR
WHAT’S NEW IN PHP 7.4 - FEATURES
NULL COALESCING ASSIGNMENT OPERATOR
‣ If the left parameter is null, assigns the value of the right
parameter to the left one. If the value is not null, nothing is
made.
TYPED PROPERTIES 2.0
WHAT’S NEW IN PHP 7.4 - FEATURES
WITHOUT TYPED PROPERTIES 2.0
WHAT’S NEW IN PHP 7.4 - FEATURES
WITH TYPED PROPERTIES 2.0
WHAT’S NEW IN PHP 7.4 - FEATURES
WITH TYPED PROPERTIES 2.0
‣ Property type declarations support all type declarations
supported by PHP, with the exception of void and callable
WHAT’S NEW IN PHP 7.4 - FEATURES
WITH TYPED PROPERTIES 2.0 (VARIANCE)
‣ Property types are invariant, it means that the type of a non-private
property can not change during inheritance
‣ If the parent property is private, then the type may be changed
arbitrarily
WHAT’S NEW IN PHP 7.4 - FEATURES
WITH TYPED PROPERTIES 2.0 (STRICT TYPES)
‣ Just like parameter and return type declarations, property
types are affected by the strict_types directive
NUMERIC LITERAL SEPARATOR
WHAT’S NEW IN PHP 7.4 - FEATURES
WITHOUT NUMERIC LITERAL SEPARATOR
‣ The human eye is not optimized for quickly parsing long
sequences of digits
WHAT’S NEW IN PHP 7.4 - FEATURES
WITH NUMERIC LITERAL SEPARATOR
WHAT’S NEW IN PHP 7.4 - FEATURES
NUMERIC LITERAL SEPARATOR (ERRORS)
DEPRECATIONS
LET’S SEE SOME
LEFT-ASSOCIATIVE TERNARY OPERATOR
WHAT’S NEW IN PHP 7.4 - DEPRECATIONS
LEFT-ASSOCIATIVE TERNARY OPERATOR
‣ Unlike most other languages, the ternary operator in PHP
is left-associative rather than right-associative
‣ Using nested ternaries without explicit parentheses will
throw a deprecation warning
CONCATENATION PRECEDENCE
WHAT’S NEW IN PHP 7.4 - DEPRECATIONS
CONCATENATION PRECEDENCE
‣ It’s been a long standing issue that an (unparenthesized) expression + - and .
evaluates left-to-right
‣ The precedence of . + and - is equal, in PHP 8 . will have an inferior precedence
‣ A deprecation notice upon encountering an unparenthesized expression
containing an . before + or -
CURLY BRACE SYNTAX
FOR STRINGS AND ARRAYS
WHAT’S NEW IN PHP 7.4 - DEPRECATIONS
CURLY BRACE SYNTAX FOR STRINGS AND ARRAYS
‣ PHP allowed both square brackets and curly braces to be
used interchangeably for accessing array elements and
string offsets
A FEW MORE DEPRECATIONS
WHAT’S NEW IN PHP 7.4 - DEPRECATIONS
A FEW MORE DEPRECATIONS
‣ The real type (rarely used float, double alias)
‣ Magic quotes legacy (get_magic_quotes_gpc() and
get_magic_quotes_runtime())
‣ array_key_exists() with objects
‣ money_format() which is not supported on all platforms;
nowadays NumberFormatter::formatCurrency() should
be used instead
42
QUESTIONS?

More Related Content

What's hot

[Perforce] Perforce the Plentiful Platform
[Perforce] Perforce the Plentiful Platform[Perforce] Perforce the Plentiful Platform
[Perforce] Perforce the Plentiful PlatformPerforce
 
Cenário atual do PHP e Introdução ao Laravel no Devinvale 2014
Cenário atual do PHP e Introdução ao Laravel no Devinvale 2014Cenário atual do PHP e Introdução ao Laravel no Devinvale 2014
Cenário atual do PHP e Introdução ao Laravel no Devinvale 2014Julio Bitencourt
 
2021.laravelconf.tw.slides1
2021.laravelconf.tw.slides12021.laravelconf.tw.slides1
2021.laravelconf.tw.slides1LiviaLiaoFontech
 
Plone i18n, LinguaPlone
Plone i18n, LinguaPlonePlone i18n, LinguaPlone
Plone i18n, LinguaPloneQuintagroup
 
Anton Mishchuk - Multi-language FBP with Flowex
Anton Mishchuk - Multi-language FBP with FlowexAnton Mishchuk - Multi-language FBP with Flowex
Anton Mishchuk - Multi-language FBP with FlowexElixir Club
 
10 Most Important Features of New PHP 5.6
10 Most Important Features of New PHP 5.610 Most Important Features of New PHP 5.6
10 Most Important Features of New PHP 5.6Webline Infosoft P Ltd
 
Setting advanced PHP development environment
Setting advanced PHP development environmentSetting advanced PHP development environment
Setting advanced PHP development environmentKapil Sharma
 
How to publish Open api 3.0 with SAP PO and KaTe RESTful adapter
How to publish Open api 3.0 with SAP PO and KaTe RESTful adapterHow to publish Open api 3.0 with SAP PO and KaTe RESTful adapter
How to publish Open api 3.0 with SAP PO and KaTe RESTful adapterKate_RESTful
 
クリーンアーキテクチャの考え方にもとづく Laravel との付き合い方 #phpcondo
クリーンアーキテクチャの考え方にもとづく Laravel との付き合い方 #phpcondoクリーンアーキテクチャの考え方にもとづく Laravel との付き合い方 #phpcondo
クリーンアーキテクチャの考え方にもとづく Laravel との付き合い方 #phpcondoShohei Okada
 
OpenAPI 2.0 with SAP PO / SAP PI & KaTe's RESTful adapter
OpenAPI 2.0 with SAP PO / SAP PI & KaTe's RESTful adapterOpenAPI 2.0 with SAP PO / SAP PI & KaTe's RESTful adapter
OpenAPI 2.0 with SAP PO / SAP PI & KaTe's RESTful adapterKate_RESTful
 
Flowex - Railway Flow-Based Programming with Elixir GenStage.
Flowex - Railway Flow-Based Programming with Elixir GenStage.Flowex - Railway Flow-Based Programming with Elixir GenStage.
Flowex - Railway Flow-Based Programming with Elixir GenStage.Anton Mishchuk
 
High Performance Haskell
High Performance HaskellHigh Performance Haskell
High Performance HaskellHarendra Kumar
 
Multi-language FBP with flowex
Multi-language FBP with flowexMulti-language FBP with flowex
Multi-language FBP with flowexAnton Mishchuk
 

What's hot (20)

[Perforce] Perforce the Plentiful Platform
[Perforce] Perforce the Plentiful Platform[Perforce] Perforce the Plentiful Platform
[Perforce] Perforce the Plentiful Platform
 
Phalcon 2 - PHP Brazil Conference
Phalcon 2 - PHP Brazil ConferencePhalcon 2 - PHP Brazil Conference
Phalcon 2 - PHP Brazil Conference
 
Cenário atual do PHP e Introdução ao Laravel no Devinvale 2014
Cenário atual do PHP e Introdução ao Laravel no Devinvale 2014Cenário atual do PHP e Introdução ao Laravel no Devinvale 2014
Cenário atual do PHP e Introdução ao Laravel no Devinvale 2014
 
2021.laravelconf.tw.slides1
2021.laravelconf.tw.slides12021.laravelconf.tw.slides1
2021.laravelconf.tw.slides1
 
Plone i18n, LinguaPlone
Plone i18n, LinguaPlonePlone i18n, LinguaPlone
Plone i18n, LinguaPlone
 
Anton Mishchuk - Multi-language FBP with Flowex
Anton Mishchuk - Multi-language FBP with FlowexAnton Mishchuk - Multi-language FBP with Flowex
Anton Mishchuk - Multi-language FBP with Flowex
 
New features of rails 5
New features of rails 5New features of rails 5
New features of rails 5
 
Introduction to ABAP
Introduction to ABAPIntroduction to ABAP
Introduction to ABAP
 
10 Most Important Features of New PHP 5.6
10 Most Important Features of New PHP 5.610 Most Important Features of New PHP 5.6
10 Most Important Features of New PHP 5.6
 
Setting advanced PHP development environment
Setting advanced PHP development environmentSetting advanced PHP development environment
Setting advanced PHP development environment
 
How to publish Open api 3.0 with SAP PO and KaTe RESTful adapter
How to publish Open api 3.0 with SAP PO and KaTe RESTful adapterHow to publish Open api 3.0 with SAP PO and KaTe RESTful adapter
How to publish Open api 3.0 with SAP PO and KaTe RESTful adapter
 
クリーンアーキテクチャの考え方にもとづく Laravel との付き合い方 #phpcondo
クリーンアーキテクチャの考え方にもとづく Laravel との付き合い方 #phpcondoクリーンアーキテクチャの考え方にもとづく Laravel との付き合い方 #phpcondo
クリーンアーキテクチャの考え方にもとづく Laravel との付き合い方 #phpcondo
 
SAP ABAP Training
SAP ABAP TrainingSAP ABAP Training
SAP ABAP Training
 
OpenAPI 2.0 with SAP PO / SAP PI & KaTe's RESTful adapter
OpenAPI 2.0 with SAP PO / SAP PI & KaTe's RESTful adapterOpenAPI 2.0 with SAP PO / SAP PI & KaTe's RESTful adapter
OpenAPI 2.0 with SAP PO / SAP PI & KaTe's RESTful adapter
 
Phalcon
PhalconPhalcon
Phalcon
 
Flowex - Railway Flow-Based Programming with Elixir GenStage.
Flowex - Railway Flow-Based Programming with Elixir GenStage.Flowex - Railway Flow-Based Programming with Elixir GenStage.
Flowex - Railway Flow-Based Programming with Elixir GenStage.
 
High Performance Haskell
High Performance HaskellHigh Performance Haskell
High Performance Haskell
 
Multi-language FBP with flowex
Multi-language FBP with flowexMulti-language FBP with flowex
Multi-language FBP with flowex
 
Php
PhpPhp
Php
 
Php
PhpPhp
Php
 

Similar to What's new in PHP 7.4

php 7.4 for word press developers
php 7.4 for word press developersphp 7.4 for word press developers
php 7.4 for word press developersRahul Rana
 
Php5 vs php7
Php5 vs php7Php5 vs php7
Php5 vs php7gentlex2
 
All you need to know about latest php version 7.4
All you need to know about latest php version 7.4All you need to know about latest php version 7.4
All you need to know about latest php version 7.4Semidot Infotech
 
Php 5.6 vs Php 7 performance comparison
Php 5.6 vs Php 7 performance comparisonPhp 5.6 vs Php 7 performance comparison
Php 5.6 vs Php 7 performance comparisonTu Pham
 
PHP 7X New Features
PHP 7X New FeaturesPHP 7X New Features
PHP 7X New FeaturesThanh Tai
 
PHP 8: What's New and Changed
PHP 8: What's New and ChangedPHP 8: What's New and Changed
PHP 8: What's New and ChangedAyesh Karunaratne
 
Php 7.2 compliance workshop php benelux
Php 7.2 compliance workshop php beneluxPhp 7.2 compliance workshop php benelux
Php 7.2 compliance workshop php beneluxDamien Seguy
 
Upstate CSCI 450 PHP Chapters 5, 12, 13
Upstate CSCI 450 PHP Chapters 5, 12, 13Upstate CSCI 450 PHP Chapters 5, 12, 13
Upstate CSCI 450 PHP Chapters 5, 12, 13DanWooster1
 
PHP 7 - Above and Beyond
PHP 7 - Above and BeyondPHP 7 - Above and Beyond
PHP 7 - Above and Beyondrafaelfqf
 
PHP 5.4 - Begin your love affair with traits
PHP 5.4 - Begin your love affair with traitsPHP 5.4 - Begin your love affair with traits
PHP 5.4 - Begin your love affair with traitsGraham Weldon
 
Upstate CSCI 450 PHP
Upstate CSCI 450 PHPUpstate CSCI 450 PHP
Upstate CSCI 450 PHPDanWooster1
 
Introduction into PHP5 (Jeroen van Sluijs)
Introduction into PHP5 (Jeroen van Sluijs)Introduction into PHP5 (Jeroen van Sluijs)
Introduction into PHP5 (Jeroen van Sluijs)Stefan Koopmanschap
 
Java 10 New Features
Java 10 New FeaturesJava 10 New Features
Java 10 New FeaturesAli BAKAN
 

Similar to What's new in PHP 7.4 (20)

Start using PHP 7
Start using PHP 7Start using PHP 7
Start using PHP 7
 
php 7.4 for word press developers
php 7.4 for word press developersphp 7.4 for word press developers
php 7.4 for word press developers
 
Php5 vs php7
Php5 vs php7Php5 vs php7
Php5 vs php7
 
All you need to know about latest php version 7.4
All you need to know about latest php version 7.4All you need to know about latest php version 7.4
All you need to know about latest php version 7.4
 
Php 5.6 vs Php 7 performance comparison
Php 5.6 vs Php 7 performance comparisonPhp 5.6 vs Php 7 performance comparison
Php 5.6 vs Php 7 performance comparison
 
PHP 7X New Features
PHP 7X New FeaturesPHP 7X New Features
PHP 7X New Features
 
PHP 8: What's New and Changed
PHP 8: What's New and ChangedPHP 8: What's New and Changed
PHP 8: What's New and Changed
 
PHP
PHPPHP
PHP
 
Php notes
Php notesPhp notes
Php notes
 
Php ppt
Php pptPhp ppt
Php ppt
 
Php 7.2 compliance workshop php benelux
Php 7.2 compliance workshop php beneluxPhp 7.2 compliance workshop php benelux
Php 7.2 compliance workshop php benelux
 
Upstate CSCI 450 PHP Chapters 5, 12, 13
Upstate CSCI 450 PHP Chapters 5, 12, 13Upstate CSCI 450 PHP Chapters 5, 12, 13
Upstate CSCI 450 PHP Chapters 5, 12, 13
 
PHP 7 - Above and Beyond
PHP 7 - Above and BeyondPHP 7 - Above and Beyond
PHP 7 - Above and Beyond
 
Migrating to PHP 7
Migrating to PHP 7Migrating to PHP 7
Migrating to PHP 7
 
Php 7 - YNS
Php 7 - YNSPhp 7 - YNS
Php 7 - YNS
 
PHP
PHPPHP
PHP
 
PHP 5.4 - Begin your love affair with traits
PHP 5.4 - Begin your love affair with traitsPHP 5.4 - Begin your love affair with traits
PHP 5.4 - Begin your love affair with traits
 
Upstate CSCI 450 PHP
Upstate CSCI 450 PHPUpstate CSCI 450 PHP
Upstate CSCI 450 PHP
 
Introduction into PHP5 (Jeroen van Sluijs)
Introduction into PHP5 (Jeroen van Sluijs)Introduction into PHP5 (Jeroen van Sluijs)
Introduction into PHP5 (Jeroen van Sluijs)
 
Java 10 New Features
Java 10 New FeaturesJava 10 New Features
Java 10 New Features
 

Recently uploaded

Simplifying Microservices & Apps - The art of effortless development - Meetup...
Simplifying Microservices & Apps - The art of effortless development - Meetup...Simplifying Microservices & Apps - The art of effortless development - Meetup...
Simplifying Microservices & Apps - The art of effortless development - Meetup...Rob Geurden
 
The Role of IoT and Sensor Technology in Cargo Cloud Solutions.pptx
The Role of IoT and Sensor Technology in Cargo Cloud Solutions.pptxThe Role of IoT and Sensor Technology in Cargo Cloud Solutions.pptx
The Role of IoT and Sensor Technology in Cargo Cloud Solutions.pptxRTS corp
 
What’s New in VictoriaMetrics: Q1 2024 Updates
What’s New in VictoriaMetrics: Q1 2024 UpdatesWhat’s New in VictoriaMetrics: Q1 2024 Updates
What’s New in VictoriaMetrics: Q1 2024 UpdatesVictoriaMetrics
 
OpenChain Education Work Group Monthly Meeting - 2024-04-10 - Full Recording
OpenChain Education Work Group Monthly Meeting - 2024-04-10 - Full RecordingOpenChain Education Work Group Monthly Meeting - 2024-04-10 - Full Recording
OpenChain Education Work Group Monthly Meeting - 2024-04-10 - Full RecordingShane Coughlan
 
UI5ers live - Custom Controls wrapping 3rd-party libs.pptx
UI5ers live - Custom Controls wrapping 3rd-party libs.pptxUI5ers live - Custom Controls wrapping 3rd-party libs.pptx
UI5ers live - Custom Controls wrapping 3rd-party libs.pptxAndreas Kunz
 
Precise and Complete Requirements? An Elusive Goal
Precise and Complete Requirements? An Elusive GoalPrecise and Complete Requirements? An Elusive Goal
Precise and Complete Requirements? An Elusive GoalLionel Briand
 
VictoriaMetrics Anomaly Detection Updates: Q1 2024
VictoriaMetrics Anomaly Detection Updates: Q1 2024VictoriaMetrics Anomaly Detection Updates: Q1 2024
VictoriaMetrics Anomaly Detection Updates: Q1 2024VictoriaMetrics
 
How to submit a standout Adobe Champion Application
How to submit a standout Adobe Champion ApplicationHow to submit a standout Adobe Champion Application
How to submit a standout Adobe Champion ApplicationBradBedford3
 
2024 DevNexus Patterns for Resiliency: Shuffle shards
2024 DevNexus Patterns for Resiliency: Shuffle shards2024 DevNexus Patterns for Resiliency: Shuffle shards
2024 DevNexus Patterns for Resiliency: Shuffle shardsChristopher Curtin
 
Leveraging AI for Mobile App Testing on Real Devices | Applitools + Kobiton
Leveraging AI for Mobile App Testing on Real Devices | Applitools + KobitonLeveraging AI for Mobile App Testing on Real Devices | Applitools + Kobiton
Leveraging AI for Mobile App Testing on Real Devices | Applitools + KobitonApplitools
 
Best Angular 17 Classroom & Online training - Naresh IT
Best Angular 17 Classroom & Online training - Naresh ITBest Angular 17 Classroom & Online training - Naresh IT
Best Angular 17 Classroom & Online training - Naresh ITmanoharjgpsolutions
 
Machine Learning Software Engineering Patterns and Their Engineering
Machine Learning Software Engineering Patterns and Their EngineeringMachine Learning Software Engineering Patterns and Their Engineering
Machine Learning Software Engineering Patterns and Their EngineeringHironori Washizaki
 
VK Business Profile - provides IT solutions and Web Development
VK Business Profile - provides IT solutions and Web DevelopmentVK Business Profile - provides IT solutions and Web Development
VK Business Profile - provides IT solutions and Web Developmentvyaparkranti
 
Introduction to Firebase Workshop Slides
Introduction to Firebase Workshop SlidesIntroduction to Firebase Workshop Slides
Introduction to Firebase Workshop Slidesvaideheekore1
 
OpenChain AI Study Group - Europe and Asia Recap - 2024-04-11 - Full Recording
OpenChain AI Study Group - Europe and Asia Recap - 2024-04-11 - Full RecordingOpenChain AI Study Group - Europe and Asia Recap - 2024-04-11 - Full Recording
OpenChain AI Study Group - Europe and Asia Recap - 2024-04-11 - Full RecordingShane Coughlan
 
Ronisha Informatics Private Limited Catalogue
Ronisha Informatics Private Limited CatalogueRonisha Informatics Private Limited Catalogue
Ronisha Informatics Private Limited Catalogueitservices996
 
Osi security architecture in network.pptx
Osi security architecture in network.pptxOsi security architecture in network.pptx
Osi security architecture in network.pptxVinzoCenzo
 
Large Language Models for Test Case Evolution and Repair
Large Language Models for Test Case Evolution and RepairLarge Language Models for Test Case Evolution and Repair
Large Language Models for Test Case Evolution and RepairLionel Briand
 
Patterns for automating API delivery. API conference
Patterns for automating API delivery. API conferencePatterns for automating API delivery. API conference
Patterns for automating API delivery. API conferencessuser9e7c64
 
Enhancing Supply Chain Visibility with Cargo Cloud Solutions.pdf
Enhancing Supply Chain Visibility with Cargo Cloud Solutions.pdfEnhancing Supply Chain Visibility with Cargo Cloud Solutions.pdf
Enhancing Supply Chain Visibility with Cargo Cloud Solutions.pdfRTS corp
 

Recently uploaded (20)

Simplifying Microservices & Apps - The art of effortless development - Meetup...
Simplifying Microservices & Apps - The art of effortless development - Meetup...Simplifying Microservices & Apps - The art of effortless development - Meetup...
Simplifying Microservices & Apps - The art of effortless development - Meetup...
 
The Role of IoT and Sensor Technology in Cargo Cloud Solutions.pptx
The Role of IoT and Sensor Technology in Cargo Cloud Solutions.pptxThe Role of IoT and Sensor Technology in Cargo Cloud Solutions.pptx
The Role of IoT and Sensor Technology in Cargo Cloud Solutions.pptx
 
What’s New in VictoriaMetrics: Q1 2024 Updates
What’s New in VictoriaMetrics: Q1 2024 UpdatesWhat’s New in VictoriaMetrics: Q1 2024 Updates
What’s New in VictoriaMetrics: Q1 2024 Updates
 
OpenChain Education Work Group Monthly Meeting - 2024-04-10 - Full Recording
OpenChain Education Work Group Monthly Meeting - 2024-04-10 - Full RecordingOpenChain Education Work Group Monthly Meeting - 2024-04-10 - Full Recording
OpenChain Education Work Group Monthly Meeting - 2024-04-10 - Full Recording
 
UI5ers live - Custom Controls wrapping 3rd-party libs.pptx
UI5ers live - Custom Controls wrapping 3rd-party libs.pptxUI5ers live - Custom Controls wrapping 3rd-party libs.pptx
UI5ers live - Custom Controls wrapping 3rd-party libs.pptx
 
Precise and Complete Requirements? An Elusive Goal
Precise and Complete Requirements? An Elusive GoalPrecise and Complete Requirements? An Elusive Goal
Precise and Complete Requirements? An Elusive Goal
 
VictoriaMetrics Anomaly Detection Updates: Q1 2024
VictoriaMetrics Anomaly Detection Updates: Q1 2024VictoriaMetrics Anomaly Detection Updates: Q1 2024
VictoriaMetrics Anomaly Detection Updates: Q1 2024
 
How to submit a standout Adobe Champion Application
How to submit a standout Adobe Champion ApplicationHow to submit a standout Adobe Champion Application
How to submit a standout Adobe Champion Application
 
2024 DevNexus Patterns for Resiliency: Shuffle shards
2024 DevNexus Patterns for Resiliency: Shuffle shards2024 DevNexus Patterns for Resiliency: Shuffle shards
2024 DevNexus Patterns for Resiliency: Shuffle shards
 
Leveraging AI for Mobile App Testing on Real Devices | Applitools + Kobiton
Leveraging AI for Mobile App Testing on Real Devices | Applitools + KobitonLeveraging AI for Mobile App Testing on Real Devices | Applitools + Kobiton
Leveraging AI for Mobile App Testing on Real Devices | Applitools + Kobiton
 
Best Angular 17 Classroom & Online training - Naresh IT
Best Angular 17 Classroom & Online training - Naresh ITBest Angular 17 Classroom & Online training - Naresh IT
Best Angular 17 Classroom & Online training - Naresh IT
 
Machine Learning Software Engineering Patterns and Their Engineering
Machine Learning Software Engineering Patterns and Their EngineeringMachine Learning Software Engineering Patterns and Their Engineering
Machine Learning Software Engineering Patterns and Their Engineering
 
VK Business Profile - provides IT solutions and Web Development
VK Business Profile - provides IT solutions and Web DevelopmentVK Business Profile - provides IT solutions and Web Development
VK Business Profile - provides IT solutions and Web Development
 
Introduction to Firebase Workshop Slides
Introduction to Firebase Workshop SlidesIntroduction to Firebase Workshop Slides
Introduction to Firebase Workshop Slides
 
OpenChain AI Study Group - Europe and Asia Recap - 2024-04-11 - Full Recording
OpenChain AI Study Group - Europe and Asia Recap - 2024-04-11 - Full RecordingOpenChain AI Study Group - Europe and Asia Recap - 2024-04-11 - Full Recording
OpenChain AI Study Group - Europe and Asia Recap - 2024-04-11 - Full Recording
 
Ronisha Informatics Private Limited Catalogue
Ronisha Informatics Private Limited CatalogueRonisha Informatics Private Limited Catalogue
Ronisha Informatics Private Limited Catalogue
 
Osi security architecture in network.pptx
Osi security architecture in network.pptxOsi security architecture in network.pptx
Osi security architecture in network.pptx
 
Large Language Models for Test Case Evolution and Repair
Large Language Models for Test Case Evolution and RepairLarge Language Models for Test Case Evolution and Repair
Large Language Models for Test Case Evolution and Repair
 
Patterns for automating API delivery. API conference
Patterns for automating API delivery. API conferencePatterns for automating API delivery. API conference
Patterns for automating API delivery. API conference
 
Enhancing Supply Chain Visibility with Cargo Cloud Solutions.pdf
Enhancing Supply Chain Visibility with Cargo Cloud Solutions.pdfEnhancing Supply Chain Visibility with Cargo Cloud Solutions.pdf
Enhancing Supply Chain Visibility with Cargo Cloud Solutions.pdf
 

What's new in PHP 7.4

  • 2. WHAT’S NEW IN PHP 7.4 SOURCES ‣ Brent Roose - What's new in PHP 7.4 ‣ Carlo Daniele - What's new in PHP 7.4 (Features, Deprecations, Speed) ‣ RFCs PHP 7.4 ‣ Brent Roose - Preloading in PHP 7.4 ‣ David Shafik - PHP Performance I: Everything You Need to Know About OpCode Caches
  • 3. WHAT’S NEW IN PHP 7.4 RELEASE TIMELINE ▸ 13/6/19 - 7.4 Alpha1 ▸ 25/7/19 - 7.4 Beta1 ▸ 5/9/19 - 7.4 RC1 ▸ …[RC2, RC3, RC4, RC5] ▸ 14/11/19 - 7.4 RC6 ▸ 28/11/19 - 7.4 GA ▸ 18/12/19 - 7.4.1
  • 6. WHAT’S NEW IN PHP 7.4 - FEATURES ARRAY SPREAD OPERATOR ‣ An array pair prefixed by … will be expanded in places during array definition
  • 7. WHAT’S NEW IN PHP 7.4 - FEATURES ARRAY SPREAD OPERATOR (ERRORS) ‣ In order to make the behavior consistent with argument unpacking, string keys are not supported ‣ It’s not possible to unpack an array by reference
  • 9. WHAT’S NEW IN PHP 7.4 - FEATURES PHP LIFECYCLE
  • 10. WHAT’S NEW IN PHP 7.4 - FEATURES PHP LIFECYCLE
  • 11. WHAT’S NEW IN PHP 7.4 - FEATURES PRELOADING ‣ Preloading is controlled by just a single new php.ini directive: opcache.preload ‣ Using this directive we will specify a single PHP file which will perform the preloading task ‣ Once loaded, this file is then fully executed - and may preload other files, either by including them or by using the opcache_compile_file() function at module initialization ‣ Preloaded files remain cached in opcache memory forever, modification of their corresponding source files won’t have any effect without another server restart ‣ In order for files to be preloaded, their dependencies (interfaces, parent classes and traits) must be preloaded too
  • 12. WHAT’S NEW IN PHP 7.4 - FEATURES PRELOADING (SYMFONY 4.4) ‣ Symfony 4.4 can generate a preloading file for your application in the cache directory, that includes both the environment and and kernel names: /path/to/project/var/cache/prod/App_KernelProdContainer.preload.php
  • 13. WHAT’S NEW IN PHP 7.4 - FEATURES PRELOADING (PERFORMANCES) ‣ You could decide to only preload “hot classes” (classes that are used often in your codebase ‣ Benjamin Morel’s benchmark shows that only loading around 100 hot classes, actually yields better performance gains than preloading everything (13% to 17% performance increase)
  • 14. WHAT’S NEW IN PHP 7.4 - FEATURES WITH PRELOADING (BACKWARD COMPATIBILITY) ‣ Since preloaded classes and functions are always available, function_exists() and class_exists() always return TRUE ‣ Incorrect usage on a server with more than one app could result in failures; as different apps (or different versions of the same app) may have the same class/function names in different files, so if one version of the class is preloaded it will prevent loading of any other version of that class defined in a different file
  • 16. WHAT’S NEW IN PHP 7.4 - FEATURES VARIANCE Within the type system, a typing rule or a type constructor is: ‣ covariant if it preserves the ordering of types (from more specific to more generic) e.g. Cat() is an Animal() ‣ contravariant if it reverses this ordering e.g. an Animal() is a Cat() ‣ variant if covariant or contravariant ‣ invariant if neither of these applies
  • 17. WHAT’S NEW IN PHP 7.4 - FEATURES WITHOUT COVARIANT RETURNS AND CONTRAVARIANT PARAMETERS ‣ Until 7.3, PHP had mostly invariant return types and did not permit choosing less specific parameter types or more specific return types even though these substitutions were type-safe
  • 18. WHAT’S NEW IN PHP 7.4 - FEATURES WITH COVARIANT RETURNS AND CONTRAVARIANT PARAMETERS
  • 20. WHAT’S NEW IN PHP 7.4 - FEATURES WITHOUT ARROW FUNCTIONS 2.0 ‣ Anonymous functions in PHP can be quite verbose and partly this is due to the need to manually import used variables
  • 21. WHAT’S NEW IN PHP 7.4 - FEATURES WITH ARROW FUNCTIONS 2.0 ‣ When a variable used in the expression is defined in the parent scope it will be implicitly captured by-value
  • 22. WHAT’S NEW IN PHP 7.4 - FEATURES WITH ARROW FUNCTIONS 2.0
  • 23. WHAT’S NEW IN PHP 7.4 - FEATURES ARROW FUNCTIONS 2.0 (BACKWARD COMPATIBILITY) Unfortunately the fn keyword must be a full keyword and not just a reserved function name
  • 25. WHAT’S NEW IN PHP 7.4 - FEATURES FOREIGN FUNCTION INTERFACE ‣ FFI opens a way to write PHP extensions and bindings to C libraries in pure PHP.
  • 27. WHAT’S NEW IN PHP 7.4 - FEATURES NULL COALESCING ASSIGNMENT OPERATOR ‣ If the left parameter is null, assigns the value of the right parameter to the left one. If the value is not null, nothing is made.
  • 29. WHAT’S NEW IN PHP 7.4 - FEATURES WITHOUT TYPED PROPERTIES 2.0
  • 30. WHAT’S NEW IN PHP 7.4 - FEATURES WITH TYPED PROPERTIES 2.0
  • 31. WHAT’S NEW IN PHP 7.4 - FEATURES WITH TYPED PROPERTIES 2.0 ‣ Property type declarations support all type declarations supported by PHP, with the exception of void and callable
  • 32. WHAT’S NEW IN PHP 7.4 - FEATURES WITH TYPED PROPERTIES 2.0 (VARIANCE) ‣ Property types are invariant, it means that the type of a non-private property can not change during inheritance ‣ If the parent property is private, then the type may be changed arbitrarily
  • 33. WHAT’S NEW IN PHP 7.4 - FEATURES WITH TYPED PROPERTIES 2.0 (STRICT TYPES) ‣ Just like parameter and return type declarations, property types are affected by the strict_types directive
  • 35. WHAT’S NEW IN PHP 7.4 - FEATURES WITHOUT NUMERIC LITERAL SEPARATOR ‣ The human eye is not optimized for quickly parsing long sequences of digits
  • 36. WHAT’S NEW IN PHP 7.4 - FEATURES WITH NUMERIC LITERAL SEPARATOR
  • 37. WHAT’S NEW IN PHP 7.4 - FEATURES NUMERIC LITERAL SEPARATOR (ERRORS)
  • 40. WHAT’S NEW IN PHP 7.4 - DEPRECATIONS LEFT-ASSOCIATIVE TERNARY OPERATOR ‣ Unlike most other languages, the ternary operator in PHP is left-associative rather than right-associative ‣ Using nested ternaries without explicit parentheses will throw a deprecation warning
  • 42. WHAT’S NEW IN PHP 7.4 - DEPRECATIONS CONCATENATION PRECEDENCE ‣ It’s been a long standing issue that an (unparenthesized) expression + - and . evaluates left-to-right ‣ The precedence of . + and - is equal, in PHP 8 . will have an inferior precedence ‣ A deprecation notice upon encountering an unparenthesized expression containing an . before + or -
  • 43. CURLY BRACE SYNTAX FOR STRINGS AND ARRAYS
  • 44. WHAT’S NEW IN PHP 7.4 - DEPRECATIONS CURLY BRACE SYNTAX FOR STRINGS AND ARRAYS ‣ PHP allowed both square brackets and curly braces to be used interchangeably for accessing array elements and string offsets
  • 45. A FEW MORE DEPRECATIONS
  • 46. WHAT’S NEW IN PHP 7.4 - DEPRECATIONS A FEW MORE DEPRECATIONS ‣ The real type (rarely used float, double alias) ‣ Magic quotes legacy (get_magic_quotes_gpc() and get_magic_quotes_runtime()) ‣ array_key_exists() with objects ‣ money_format() which is not supported on all platforms; nowadays NumberFormatter::formatCurrency() should be used instead