SlideShare a Scribd company logo
First look at PHP 7.4 for
WordPress developers
PHP 7.4 is scheduled for release on November 28, 2019. WordPress 5.3 will
also contain various commits that address outdated functions.
Most WordPress plugins and theme developers are unlikely to be able to use
the new PHP 7.4 features for a while, except when working on setups where
they have some control over the environment. Given the reluctance of
WordPress to link the minimum PHP version to the latest supported versions, it
may take years before it is safe to use new features. However, developers must
ensure that their plug-ins and themes are compatible with 7.4. It is also a good
practice to keep current functions.
WordPress 5.2 pushed the minimum requirement to PHP 5.6 with a recommendation of PHP 7.3. Here is an
overview of current PHP usage statistics for WordPress installations
● PHP 7.3 – 9.6%
● PHP 7.2 – 22.2%
● PHP 7.1 – 13.5%
● PHP 7.0 – 14.9%
● PHP 5.6 – 25.7%
PHP 7 New features
PHP 7.4 contains a number of new Features that make it easier to write code. The following is a brief
overview of some of the features that are likely to be useful for WordPress plug-ins and theme authors.
Typed properties
Attempting to assign the wrong data type will result in a fatal error if strict types are specified. Otherwise
PHP will force the value to the correct type.
class Event {
public int $id;
public string $title;
Arrow functions
Many developers shout for arrow functions that are similar to JavaScript. They are pretty sweet to use.
However, the arrow functions of PHP, also called "short closures"are slightly different. PHP 7.4 introduces
the fn keyword (now a reserved keyword). A short closure can have only one expression and no return
keyword. They are not as powerful as their JavaScript cousins, but they provide a quick fix for some
scenarios.
Unpack the inside of the arrays
The unpacking of arguments was introduced in PHP 5.6, so this can still be
unknown territory for many developers in the WordPress space. It was an
invaluable feature in some of my projects.
With PHP 7.4, developers can extract an array within an array. This should
be faster than array_merge () because the spread operator (...) is a
language construct instead of a function.
Null Coalescing Assignment Operator
The null coalescing assignment operator is a short way to combine an isset () check with a ternary operator.
The following example shows how you can check the variable $ product ['id']. If it is set, do nothing.
Otherwise, assign it the value on the right. You can see code development between PHP versions. It is much
easier to write in 7.4
Deprecated Features
PHP 7.4 will deprecate various features. Author of plug-ins and themes
want to consult the complete list to determine if they need to update
outdated code. I have selected a few items that I have seen in recent
years in plug-in and theme code. Most other deprecated features are
unlikely in the current code bases.
Nested Ternary Operators Without
parentheses
Nested ternary operators are generally something that you as a developer should
avoid. Serious. Just don't write them. They are difficult to follow and are prone to
bugs due to human errors. However, if you want to ignore caution and ignore good
advice, at least use parentheses. PHP 7.4 has eliminated nested ternaries
without them
Use Array_key_exists () on
objects
Developers should not use array_key_exists () on objects because objects
are not arrays. Use the more appropriate property_exists () or isset ()
property instead
Array and String
Offset access with
curly braces
Using curly braces for array and string
offset access is a bit rarer, but I've seen it
a few times in the wild. Be sure to use
square brackets such as [] instead of
curly brackets likes {}.
I hope you like this presentation, if you want to learn more about PHP,
then PHP training in Chandigarh is best for you.
Contact us for query.
Address: CBitss Technologies, sector 34A, sco 23-24-25, Chandigarh, 160022.
Mobile No: 9988741983
php 7.4 for word press developers

More Related Content

What's hot (20)

ODP
Object Oriented Design Patterns for PHP
RobertGonzalez
 
PPS
Commenting Best Practices
mh_azad
 
PPTX
PHP
Steve Fort
 
PPS
Coding Best Practices
mh_azad
 
PPT
01 Php Introduction
Geshan Manandhar
 
PPTX
Software development best practices & coding guidelines
Ankur Goyal
 
PDF
1336333055 php tutorial_from_beginner_to_master
jeeva indra
 
PPTX
Constructor and encapsulation in php
SHIVANI SONI
 
PPTX
Php.ppt
Nidhi mishra
 
PPT
PHP - Introduction to PHP Fundamentals
Vibrant Technologies & Computers
 
PPTX
PHP 7 Crash Course - php[world] 2015
Colin O'Dell
 
PPTX
What's coming in c# 9.0
Moaid Hathot
 
PPTX
PHP tutorial | ptutorial
PTutorial Web
 
PPTX
PHP slides
Farzad Wadia
 
PPT
Beginners PHP Tutorial
alexjones89
 
PDF
Php tutorial(w3schools)
Arjun Shanka
 
Object Oriented Design Patterns for PHP
RobertGonzalez
 
Commenting Best Practices
mh_azad
 
Coding Best Practices
mh_azad
 
01 Php Introduction
Geshan Manandhar
 
Software development best practices & coding guidelines
Ankur Goyal
 
1336333055 php tutorial_from_beginner_to_master
jeeva indra
 
Constructor and encapsulation in php
SHIVANI SONI
 
Php.ppt
Nidhi mishra
 
PHP - Introduction to PHP Fundamentals
Vibrant Technologies & Computers
 
PHP 7 Crash Course - php[world] 2015
Colin O'Dell
 
What's coming in c# 9.0
Moaid Hathot
 
PHP tutorial | ptutorial
PTutorial Web
 
PHP slides
Farzad Wadia
 
Beginners PHP Tutorial
alexjones89
 
Php tutorial(w3schools)
Arjun Shanka
 

Similar to php 7.4 for word press developers (20)

PDF
All you need to know about latest php version 7.4
Semidot Infotech
 
PPTX
Php7
longvohoang
 
PPTX
Zend Framework Workshop
10n Software, LLC
 
DOCX
Guidelines php 8 gig
Ditinus Technology Pvt LTD
 
PPT
Php5 vs php7
gentlex2
 
PDF
Php
Vineet Vats
 
PPT
Demo
bkslide
 
PDF
What's new in PHP 7.4
Andrea Maccis
 
PPT
sadasd
alind tiwari
 
PPT
before upload
alind tiwari
 
PPT
sdfsdf
alind tiwari
 
PPT
sdfsd
alind tiwari
 
PPT
first pitch
alind tiwari
 
PPT
latest slide
alind tiwari
 
PPT
before upload
alind tiwari
 
PPT
Unit Test for ZF SlideShare Component
zftalk
 
PPT
before upload
alind tiwari
 
PPT
ttttt
alind tiwari
 
PPT
before upload
alind tiwari
 
PPT
tiwari
alind tiwari
 
All you need to know about latest php version 7.4
Semidot Infotech
 
Zend Framework Workshop
10n Software, LLC
 
Guidelines php 8 gig
Ditinus Technology Pvt LTD
 
Php5 vs php7
gentlex2
 
Demo
bkslide
 
What's new in PHP 7.4
Andrea Maccis
 
sadasd
alind tiwari
 
before upload
alind tiwari
 
sdfsdf
alind tiwari
 
first pitch
alind tiwari
 
latest slide
alind tiwari
 
before upload
alind tiwari
 
Unit Test for ZF SlideShare Component
zftalk
 
before upload
alind tiwari
 
before upload
alind tiwari
 
tiwari
alind tiwari
 
Ad

More from Rahul Rana (13)

PPTX
Hello android example.
Rahul Rana
 
PPTX
Eucalyptus cloud computing
Rahul Rana
 
PPTX
Types of nonverbal communication
Rahul Rana
 
PPTX
Role of java in android app development
Rahul Rana
 
PPTX
What is ppc in digital marketing ?
Rahul Rana
 
PPTX
6 useful things to do with PHP
Rahul Rana
 
PPTX
How to build a website in 7 steps
Rahul Rana
 
PPTX
Few skills every successful web designer needs
Rahul Rana
 
PPTX
Php developer job description
Rahul Rana
 
PPTX
Difference between frontend and backend
Rahul Rana
 
PPTX
Top php frameworks for startups - 2019
Rahul Rana
 
PPTX
How to use the excel basic functions
Rahul Rana
 
PPTX
The 6 fastest growing tech jobs | short term computer courses in Chandigarh
Rahul Rana
 
Hello android example.
Rahul Rana
 
Eucalyptus cloud computing
Rahul Rana
 
Types of nonverbal communication
Rahul Rana
 
Role of java in android app development
Rahul Rana
 
What is ppc in digital marketing ?
Rahul Rana
 
6 useful things to do with PHP
Rahul Rana
 
How to build a website in 7 steps
Rahul Rana
 
Few skills every successful web designer needs
Rahul Rana
 
Php developer job description
Rahul Rana
 
Difference between frontend and backend
Rahul Rana
 
Top php frameworks for startups - 2019
Rahul Rana
 
How to use the excel basic functions
Rahul Rana
 
The 6 fastest growing tech jobs | short term computer courses in Chandigarh
Rahul Rana
 
Ad

Recently uploaded (20)

PPTX
Presentation: Climate Citizenship Digital Education
Karl Donert
 
PPTX
How to Configure Prepayments in Odoo 18 Sales
Celine George
 
PDF
ARAL-Orientation_Morning-Session_Day-11.pdf
JoelVilloso1
 
PPTX
ASRB NET 2023 PREVIOUS YEAR QUESTION PAPER GENETICS AND PLANT BREEDING BY SAT...
Krashi Coaching
 
PPTX
LEGAL ASPECTS OF PSYCHIATRUC NURSING.pptx
PoojaSen20
 
PDF
IMP NAAC-Reforms-Stakeholder-Consultation-Presentation-on-Draft-Metrics-Unive...
BHARTIWADEKAR
 
PPTX
Latest Features in Odoo 18 - Odoo slides
Celine George
 
PPTX
Accounting Skills Paper-I, Preparation of Vouchers
Dr. Sushil Bansode
 
PDF
The-Beginnings-of-Indian-Civilisation.pdf/6th class new ncert social/by k san...
Sandeep Swamy
 
PPTX
Nutri-QUIZ-Bee-Elementary.pptx...................
ferdinandsanbuenaven
 
PPTX
How to Manage Promotions in Odoo 18 Sales
Celine George
 
PDF
CONCURSO DE POESIA “POETUFAS – PASSOS SUAVES PELO VERSO.pdf
Colégio Santa Teresinha
 
PDF
BÀI TẬP BỔ TRỢ THEO LESSON TIẾNG ANH - I-LEARN SMART WORLD 7 - CẢ NĂM - CÓ ĐÁ...
Nguyen Thanh Tu Collection
 
PPTX
ROLE OF ANTIOXIDANT IN EYE HEALTH MANAGEMENT.pptx
Subham Panja
 
PDF
ARAL_Orientation_Day-2-Sessions_ARAL-Readung ARAL-Mathematics ARAL-Sciencev2.pdf
JoelVilloso1
 
PPTX
PPT on the Development of Education in the Victorian England
Beena E S
 
PPTX
Optimizing Cancer Screening With MCED Technologies: From Science to Practical...
i3 Health
 
PPTX
HEAD INJURY IN CHILDREN: NURSING MANAGEMENGT.pptx
PRADEEP ABOTHU
 
PDF
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 - GLOBAL SUCCESS - CẢ NĂM - NĂM 2024 (VOCABULARY, ...
Nguyen Thanh Tu Collection
 
PPTX
HYDROCEPHALUS: NURSING MANAGEMENT .pptx
PRADEEP ABOTHU
 
Presentation: Climate Citizenship Digital Education
Karl Donert
 
How to Configure Prepayments in Odoo 18 Sales
Celine George
 
ARAL-Orientation_Morning-Session_Day-11.pdf
JoelVilloso1
 
ASRB NET 2023 PREVIOUS YEAR QUESTION PAPER GENETICS AND PLANT BREEDING BY SAT...
Krashi Coaching
 
LEGAL ASPECTS OF PSYCHIATRUC NURSING.pptx
PoojaSen20
 
IMP NAAC-Reforms-Stakeholder-Consultation-Presentation-on-Draft-Metrics-Unive...
BHARTIWADEKAR
 
Latest Features in Odoo 18 - Odoo slides
Celine George
 
Accounting Skills Paper-I, Preparation of Vouchers
Dr. Sushil Bansode
 
The-Beginnings-of-Indian-Civilisation.pdf/6th class new ncert social/by k san...
Sandeep Swamy
 
Nutri-QUIZ-Bee-Elementary.pptx...................
ferdinandsanbuenaven
 
How to Manage Promotions in Odoo 18 Sales
Celine George
 
CONCURSO DE POESIA “POETUFAS – PASSOS SUAVES PELO VERSO.pdf
Colégio Santa Teresinha
 
BÀI TẬP BỔ TRỢ THEO LESSON TIẾNG ANH - I-LEARN SMART WORLD 7 - CẢ NĂM - CÓ ĐÁ...
Nguyen Thanh Tu Collection
 
ROLE OF ANTIOXIDANT IN EYE HEALTH MANAGEMENT.pptx
Subham Panja
 
ARAL_Orientation_Day-2-Sessions_ARAL-Readung ARAL-Mathematics ARAL-Sciencev2.pdf
JoelVilloso1
 
PPT on the Development of Education in the Victorian England
Beena E S
 
Optimizing Cancer Screening With MCED Technologies: From Science to Practical...
i3 Health
 
HEAD INJURY IN CHILDREN: NURSING MANAGEMENGT.pptx
PRADEEP ABOTHU
 
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 - GLOBAL SUCCESS - CẢ NĂM - NĂM 2024 (VOCABULARY, ...
Nguyen Thanh Tu Collection
 
HYDROCEPHALUS: NURSING MANAGEMENT .pptx
PRADEEP ABOTHU
 

php 7.4 for word press developers

  • 1. First look at PHP 7.4 for WordPress developers
  • 2. PHP 7.4 is scheduled for release on November 28, 2019. WordPress 5.3 will also contain various commits that address outdated functions. Most WordPress plugins and theme developers are unlikely to be able to use the new PHP 7.4 features for a while, except when working on setups where they have some control over the environment. Given the reluctance of WordPress to link the minimum PHP version to the latest supported versions, it may take years before it is safe to use new features. However, developers must ensure that their plug-ins and themes are compatible with 7.4. It is also a good practice to keep current functions.
  • 3. WordPress 5.2 pushed the minimum requirement to PHP 5.6 with a recommendation of PHP 7.3. Here is an overview of current PHP usage statistics for WordPress installations ● PHP 7.3 – 9.6% ● PHP 7.2 – 22.2% ● PHP 7.1 – 13.5% ● PHP 7.0 – 14.9% ● PHP 5.6 – 25.7%
  • 4. PHP 7 New features PHP 7.4 contains a number of new Features that make it easier to write code. The following is a brief overview of some of the features that are likely to be useful for WordPress plug-ins and theme authors. Typed properties
  • 5. Attempting to assign the wrong data type will result in a fatal error if strict types are specified. Otherwise PHP will force the value to the correct type. class Event { public int $id; public string $title;
  • 6. Arrow functions Many developers shout for arrow functions that are similar to JavaScript. They are pretty sweet to use. However, the arrow functions of PHP, also called "short closures"are slightly different. PHP 7.4 introduces the fn keyword (now a reserved keyword). A short closure can have only one expression and no return keyword. They are not as powerful as their JavaScript cousins, but they provide a quick fix for some scenarios.
  • 7. Unpack the inside of the arrays The unpacking of arguments was introduced in PHP 5.6, so this can still be unknown territory for many developers in the WordPress space. It was an invaluable feature in some of my projects. With PHP 7.4, developers can extract an array within an array. This should be faster than array_merge () because the spread operator (...) is a language construct instead of a function.
  • 8. Null Coalescing Assignment Operator The null coalescing assignment operator is a short way to combine an isset () check with a ternary operator. The following example shows how you can check the variable $ product ['id']. If it is set, do nothing. Otherwise, assign it the value on the right. You can see code development between PHP versions. It is much easier to write in 7.4
  • 9. Deprecated Features PHP 7.4 will deprecate various features. Author of plug-ins and themes want to consult the complete list to determine if they need to update outdated code. I have selected a few items that I have seen in recent years in plug-in and theme code. Most other deprecated features are unlikely in the current code bases.
  • 10. Nested Ternary Operators Without parentheses Nested ternary operators are generally something that you as a developer should avoid. Serious. Just don't write them. They are difficult to follow and are prone to bugs due to human errors. However, if you want to ignore caution and ignore good advice, at least use parentheses. PHP 7.4 has eliminated nested ternaries without them
  • 11. Use Array_key_exists () on objects Developers should not use array_key_exists () on objects because objects are not arrays. Use the more appropriate property_exists () or isset () property instead
  • 12. Array and String Offset access with curly braces Using curly braces for array and string offset access is a bit rarer, but I've seen it a few times in the wild. Be sure to use square brackets such as [] instead of curly brackets likes {}.
  • 13. I hope you like this presentation, if you want to learn more about PHP, then PHP training in Chandigarh is best for you. Contact us for query. Address: CBitss Technologies, sector 34A, sco 23-24-25, Chandigarh, 160022. Mobile No: 9988741983