SlideShare a Scribd company logo
E D L O M O N A C O
G R D E V D A Y 2 0 1 6
Learning PHP 7
About Me
 Work At Terryberry
 Started PHP programming in 2001
 PHP 4.1 was the latest release
 I’ve Since Learned C# & Java
 PHP is still my favorite programming language
 I have a programming blog
 Eman's Programming Hub
 http://emansprogramminghub.blogspot.com
Quick History Recap
 PHP 4 was released in 2000
 PHP 5 was released in 2004
 PHP 6 Got caught up in disputes
 PHP group fought about Unicode support
 PHP 6 dissolved shortly after
 PHP 7 was released December 2015
Why PHP 7?
 PHP 6 has too much baggage
 Most of what PHP 6 was going to offer got added in
future PHP 5 releases
 PHP 6 is considered an experimental release
 PHP 7 just made sense
PHP 7 Highlights
 64-Bit Windows Support
 64-bit support in the past was considered experimental
 Lots of depreciated functions are gone
 Most of them were considered deprecated back in PHP 5
 Old APIs & extensions are gone as well
PHP 7 Highlights
 New Zend engine (PHPNG)
 PHP operates twice as fast with better memory handling
PHPNG Figures
PHPNG Figures
H O W W I L L P H P 7 B R E A K M Y L E G A C Y C O D E ?
Breaking Changes
Breaking Changes
 E_STRICT has been reclassified
 The constant is still available to avoid breaking legacy code
Breaking Changes
 ASP-Style & Script tags are no longer supported
 All ereg functions are gone
 ereg was deprecated a while ago and using preg_* is
recommended
 Various database-specific functions are gone
 mysql
 mssql
 list function cannot be empty
 It can’t be used to unpack string variables, use str_split()
 The ordering of assignment has been reversed
Breaking Changes
 global only accepts simple variables
 Variable variables can only be used if wrapped around curly
braces; that is discouraged however.
 foreach will not change the array pointer
 Hexadecimal strings are no longer considered
numeric
Breaking Changes
 Various mcrypt functions are removed
 mcrypt_generic_end() ;
 mcrypt_generic_deinit() is preferred
 mcrypt_ecb(), mcrypt_cbc(), mcrypt_cfb() and mcrypt_ofb()
 mcrypt_decrypt() with the appropriate MCRYPT_MODE_*
constant.
 GD Type1 functions are removed
 Using TrueType fonts and their associated functions is
recommended instead.
Breaking Changes
 New objects can no longer be assigned by reference
 Was depreciated in PHP 5
 Non-static methods cannot be called as static
 Was depreciated in PHP 5.6
 $HTTP_RAW_POST_DATA is removed
 php://input is the recommended method
 JSON has been replaced with JSOND
 Numbers cannot end with decimal point
Breaking Changes
 Functions can’t have similar-named variables
 Will throw an E_COMPILE_ERROR
 Switch statement can’t have multiple default blocks
 Will throw an E_COMPILE_ERROR
 PHP 4 style constructors are depreciated
 Division by zero will now return either NAN or float
 Used to return boolean
Uniform Variable Syntax
 Uniform Variable Syntax is an effort to making PHP
more consistent.
 It’ll be read strictly left to right from now on.
H O W C A N I M A K E M Y C O D E M O R E A W E S O M E
W I T H P H P 7 ?
New Features
Scalar Type Hints & Return Types
 You can now tell a function or method what it should
accept and return
 int
 bool
 string
 float
 Type hinting is non-strict by default
 declare(strict_types=1); will make type hinting strict
Null Coalescing Operator
 Ternary on steroids.
 Useful for when using isset()
 Null Coalescing can be chained
 Will return the first defined value
Combined Comparison
 Also known as the Spaceship Operator
 Used to compare two expressions
 It’ll return -1, 0, or 1
 -1 => The leftmost value is smaller
 0 => Both values are equal
 1 => The leftmost value is greater
 Can be used with any type
Unicode Escape Syntax
 Allows you to enter Unicode character code inside
PHP string
 Hexidecimal format
Bind Closure on Call
 Shorthand to Closure->bindTo()
Group Use Declarations
 Allows for a cleaner way to grab multiple objects
from similar namespace
 Can be applied to the following:
 Methods
 Constants
 Class
Throwable
 PHP Errors are now exceptions
 Allows you to better control how to use the error provided
 Was known as EngineException during development
 EngineException replaced with Throwable in PHP 7 alpha 2
 Throwable is the base interface that all errors
reference
 Exceptions are also connected to Throwable
Anonymous Classes
 Like a regular PHP Class but anonymous
 C# & Java already do this
 Best suited for one-time processes
 You can inherit interfaces & classes
Questions?
Code Example
 https://github.com/eman1986/PHP7-Examples

More Related Content

PPTX
Python Programming Basics
PPT
Template Method Design Pattern
PDF
Introduction to Preprocessors
PPTX
Programming in python - Week 7,8
PPTX
Programming in python - Week 4
PDF
Java conditional statements
PPT
Control structures repetition
PPT
Java findamentals2
Python Programming Basics
Template Method Design Pattern
Introduction to Preprocessors
Programming in python - Week 7,8
Programming in python - Week 4
Java conditional statements
Control structures repetition
Java findamentals2

What's hot (17)

PDF
Unit testing.pptx [repaired]
PPTX
Program control statements in c#
PDF
Python master class part 1
PPTX
Control flow statements in java
PDF
ODP
Ast transformation
PDF
Python master class 2
PPTX
Presentation on Template Method Design Pattern
PPT
C Sharp Jn (3)
PPTX
Control structures in java
PPT
Md04 flow control
PPTX
Python Flow Control
ODT
Scjp questions
PDF
12 ruby blocks
PDF
Effective Unit Test Style Guide
PDF
Whats to come with swift generics
PDF
Python Loop
Unit testing.pptx [repaired]
Program control statements in c#
Python master class part 1
Control flow statements in java
Ast transformation
Python master class 2
Presentation on Template Method Design Pattern
C Sharp Jn (3)
Control structures in java
Md04 flow control
Python Flow Control
Scjp questions
12 ruby blocks
Effective Unit Test Style Guide
Whats to come with swift generics
Python Loop
Ad

Viewers also liked (9)

PPT
жылкайдар асан+щит+организации
PDF
Museo "El Huacalito"
PPTX
Cr27 provide a function to mark a matter for warehouse and generate the repor...
PPTX
sequence work ppt
PPT
Presentaciondeloslibros
PDF
WarmEarning-voice
PPT
оспанова мадина+мир и гармония+клиенты
PPTX
frases de las unidades 2 y 3 inlges
PPTX
Historia de la universidad
жылкайдар асан+щит+организации
Museo "El Huacalito"
Cr27 provide a function to mark a matter for warehouse and generate the repor...
sequence work ppt
Presentaciondeloslibros
WarmEarning-voice
оспанова мадина+мир и гармония+клиенты
frases de las unidades 2 y 3 inlges
Historia de la universidad
Ad

Similar to Learning php 7 (20)

PDF
PHP 7X New Features
PPTX
Php 5.6 vs Php 7 performance comparison
ODP
The why and how of moving to php 7.x
ODP
The why and how of moving to php 7.x
PPTX
20 cool features that is in PHP 7, we missed in PHP 5. Let walkthrough with t...
PDF
Php 7 crash course
PPTX
PHP 7 Crash Course
PPTX
PHP 7 Crash Course - php[world] 2015
PDF
Php 5.6 From the Inside Out
ODP
PhpSpec: practical introduction
PPTX
Php 7 - YNS
PDF
The why and how of moving to php 7
PDF
Programming in PHP Course Material BCA 6th Semester
PPTX
Core java
PDF
PHP7: Hello World!
PDF
Introduction to c first week slides
PDF
The why and how of moving to php 8
PDF
What To Expect From PHP7
PDF
Embrace dynamic PHP
PPT
14274730 (1).ppt
PHP 7X New Features
Php 5.6 vs Php 7 performance comparison
The why and how of moving to php 7.x
The why and how of moving to php 7.x
20 cool features that is in PHP 7, we missed in PHP 5. Let walkthrough with t...
Php 7 crash course
PHP 7 Crash Course
PHP 7 Crash Course - php[world] 2015
Php 5.6 From the Inside Out
PhpSpec: practical introduction
Php 7 - YNS
The why and how of moving to php 7
Programming in PHP Course Material BCA 6th Semester
Core java
PHP7: Hello World!
Introduction to c first week slides
The why and how of moving to php 8
What To Expect From PHP7
Embrace dynamic PHP
14274730 (1).ppt

Recently uploaded (20)

PPTX
Big Data Technologies - Introduction.pptx
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PPT
Teaching material agriculture food technology
PDF
NewMind AI Weekly Chronicles - August'25 Week I
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PPTX
Spectroscopy.pptx food analysis technology
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PDF
KodekX | Application Modernization Development
PPTX
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PDF
Encapsulation_ Review paper, used for researhc scholars
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PDF
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PPTX
Programs and apps: productivity, graphics, security and other tools
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
Big Data Technologies - Introduction.pptx
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
Teaching material agriculture food technology
NewMind AI Weekly Chronicles - August'25 Week I
Agricultural_Statistics_at_a_Glance_2022_0.pdf
Spectroscopy.pptx food analysis technology
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
KodekX | Application Modernization Development
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
Diabetes mellitus diagnosis method based random forest with bat algorithm
Encapsulation_ Review paper, used for researhc scholars
Dropbox Q2 2025 Financial Results & Investor Presentation
Mobile App Security Testing_ A Comprehensive Guide.pdf
Reach Out and Touch Someone: Haptics and Empathic Computing
Optimiser vos workloads AI/ML sur Amazon EC2 et AWS Graviton
The Rise and Fall of 3GPP – Time for a Sabbatical?
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
Programs and apps: productivity, graphics, security and other tools
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx

Learning php 7

  • 1. E D L O M O N A C O G R D E V D A Y 2 0 1 6 Learning PHP 7
  • 2. About Me  Work At Terryberry  Started PHP programming in 2001  PHP 4.1 was the latest release  I’ve Since Learned C# & Java  PHP is still my favorite programming language  I have a programming blog  Eman's Programming Hub  http://emansprogramminghub.blogspot.com
  • 3. Quick History Recap  PHP 4 was released in 2000  PHP 5 was released in 2004  PHP 6 Got caught up in disputes  PHP group fought about Unicode support  PHP 6 dissolved shortly after  PHP 7 was released December 2015
  • 4. Why PHP 7?  PHP 6 has too much baggage  Most of what PHP 6 was going to offer got added in future PHP 5 releases  PHP 6 is considered an experimental release  PHP 7 just made sense
  • 5. PHP 7 Highlights  64-Bit Windows Support  64-bit support in the past was considered experimental  Lots of depreciated functions are gone  Most of them were considered deprecated back in PHP 5  Old APIs & extensions are gone as well
  • 6. PHP 7 Highlights  New Zend engine (PHPNG)  PHP operates twice as fast with better memory handling
  • 9. H O W W I L L P H P 7 B R E A K M Y L E G A C Y C O D E ? Breaking Changes
  • 10. Breaking Changes  E_STRICT has been reclassified  The constant is still available to avoid breaking legacy code
  • 11. Breaking Changes  ASP-Style & Script tags are no longer supported  All ereg functions are gone  ereg was deprecated a while ago and using preg_* is recommended  Various database-specific functions are gone  mysql  mssql  list function cannot be empty  It can’t be used to unpack string variables, use str_split()  The ordering of assignment has been reversed
  • 12. Breaking Changes  global only accepts simple variables  Variable variables can only be used if wrapped around curly braces; that is discouraged however.  foreach will not change the array pointer  Hexadecimal strings are no longer considered numeric
  • 13. Breaking Changes  Various mcrypt functions are removed  mcrypt_generic_end() ;  mcrypt_generic_deinit() is preferred  mcrypt_ecb(), mcrypt_cbc(), mcrypt_cfb() and mcrypt_ofb()  mcrypt_decrypt() with the appropriate MCRYPT_MODE_* constant.  GD Type1 functions are removed  Using TrueType fonts and their associated functions is recommended instead.
  • 14. Breaking Changes  New objects can no longer be assigned by reference  Was depreciated in PHP 5  Non-static methods cannot be called as static  Was depreciated in PHP 5.6  $HTTP_RAW_POST_DATA is removed  php://input is the recommended method  JSON has been replaced with JSOND  Numbers cannot end with decimal point
  • 15. Breaking Changes  Functions can’t have similar-named variables  Will throw an E_COMPILE_ERROR  Switch statement can’t have multiple default blocks  Will throw an E_COMPILE_ERROR  PHP 4 style constructors are depreciated  Division by zero will now return either NAN or float  Used to return boolean
  • 16. Uniform Variable Syntax  Uniform Variable Syntax is an effort to making PHP more consistent.  It’ll be read strictly left to right from now on.
  • 17. H O W C A N I M A K E M Y C O D E M O R E A W E S O M E W I T H P H P 7 ? New Features
  • 18. Scalar Type Hints & Return Types  You can now tell a function or method what it should accept and return  int  bool  string  float  Type hinting is non-strict by default  declare(strict_types=1); will make type hinting strict
  • 19. Null Coalescing Operator  Ternary on steroids.  Useful for when using isset()  Null Coalescing can be chained  Will return the first defined value
  • 20. Combined Comparison  Also known as the Spaceship Operator  Used to compare two expressions  It’ll return -1, 0, or 1  -1 => The leftmost value is smaller  0 => Both values are equal  1 => The leftmost value is greater  Can be used with any type
  • 21. Unicode Escape Syntax  Allows you to enter Unicode character code inside PHP string  Hexidecimal format
  • 22. Bind Closure on Call  Shorthand to Closure->bindTo()
  • 23. Group Use Declarations  Allows for a cleaner way to grab multiple objects from similar namespace  Can be applied to the following:  Methods  Constants  Class
  • 24. Throwable  PHP Errors are now exceptions  Allows you to better control how to use the error provided  Was known as EngineException during development  EngineException replaced with Throwable in PHP 7 alpha 2  Throwable is the base interface that all errors reference  Exceptions are also connected to Throwable
  • 25. Anonymous Classes  Like a regular PHP Class but anonymous  C# & Java already do this  Best suited for one-time processes  You can inherit interfaces & classes