SlideShare a Scribd company logo
1 of 27
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

What's hot

Unit testing.pptx [repaired]
Unit testing.pptx [repaired]Unit testing.pptx [repaired]
Unit testing.pptx [repaired]Mohammad Asmar
 
Presentation on Template Method Design Pattern
Presentation on Template Method Design PatternPresentation on Template Method Design Pattern
Presentation on Template Method Design PatternAsif Tayef
 
C Sharp Jn (3)
C Sharp Jn (3)C Sharp Jn (3)
C Sharp Jn (3)jahanullah
 
Control structures in java
Control structures in javaControl structures in java
Control structures in javaVINOTH R
 
Scjp questions
Scjp questionsScjp questions
Scjp questionsroudhran
 
Effective Unit Test Style Guide
Effective Unit Test Style GuideEffective Unit Test Style Guide
Effective Unit Test Style GuideJacky Lai
 
Whats to come with swift generics
Whats to come with swift genericsWhats to come with swift generics
Whats to come with swift genericsDenis Poifol
 

What's hot (17)

Unit testing.pptx [repaired]
Unit testing.pptx [repaired]Unit testing.pptx [repaired]
Unit testing.pptx [repaired]
 
Program control statements in c#
Program control statements in c#Program control statements in c#
Program control statements in c#
 
Python master class part 1
Python master class part 1Python master class part 1
Python master class part 1
 
Control flow statements in java
Control flow statements in javaControl flow statements in java
Control flow statements in java
 
Lecture 5
Lecture 5Lecture 5
Lecture 5
 
Ast transformation
Ast transformationAst transformation
Ast transformation
 
Python master class 2
Python master class 2Python master class 2
Python master class 2
 
Presentation on Template Method Design Pattern
Presentation on Template Method Design PatternPresentation on Template Method Design Pattern
Presentation on Template Method Design Pattern
 
C Sharp Jn (3)
C Sharp Jn (3)C Sharp Jn (3)
C Sharp Jn (3)
 
Control structures in java
Control structures in javaControl structures in java
Control structures in java
 
Md04 flow control
Md04 flow controlMd04 flow control
Md04 flow control
 
Python Flow Control
Python Flow ControlPython Flow Control
Python Flow Control
 
Scjp questions
Scjp questionsScjp questions
Scjp questions
 
12 ruby blocks
12 ruby blocks12 ruby blocks
12 ruby blocks
 
Effective Unit Test Style Guide
Effective Unit Test Style GuideEffective Unit Test Style Guide
Effective Unit Test Style Guide
 
Whats to come with swift generics
Whats to come with swift genericsWhats to come with swift generics
Whats to come with swift generics
 
Python Loop
Python LoopPython Loop
Python Loop
 

Viewers also liked

жылкайдар асан+щит+организации
жылкайдар асан+щит+организациижылкайдар асан+щит+организации
жылкайдар асан+щит+организацииAsan Zhylkaidar
 
Museo "El Huacalito"
Museo "El Huacalito"Museo "El Huacalito"
Museo "El Huacalito"Richy Leyva
 
Cr27 provide a function to mark a matter for warehouse and generate the repor...
Cr27 provide a function to mark a matter for warehouse and generate the repor...Cr27 provide a function to mark a matter for warehouse and generate the repor...
Cr27 provide a function to mark a matter for warehouse and generate the repor...Visoft Pte Ltd
 
WarmEarning-voice
WarmEarning-voiceWarmEarning-voice
WarmEarning-voiceuet buddy
 
оспанова мадина+мир и гармония+клиенты
оспанова мадина+мир и гармония+клиентыоспанова мадина+мир и гармония+клиенты
оспанова мадина+мир и гармония+клиентыprogrammist
 
frases de las unidades 2 y 3 inlges
frases de las unidades 2 y 3 inlgesfrases de las unidades 2 y 3 inlges
frases de las unidades 2 y 3 inlgesyaneth Mendez
 
Historia de la universidad
Historia de la universidadHistoria de la universidad
Historia de la universidadAngie Moreno
 

Viewers also liked (9)

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

Similar to Learning php 7

PHP 7X New Features
PHP 7X New FeaturesPHP 7X New Features
PHP 7X New FeaturesThanh Tai
 
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
 
The why and how of moving to php 7.x
The why and how of moving to php 7.xThe why and how of moving to php 7.x
The why and how of moving to php 7.xWim Godden
 
The why and how of moving to php 7.x
The why and how of moving to php 7.xThe why and how of moving to php 7.x
The why and how of moving to php 7.xWim Godden
 
20 cool features that is in PHP 7, we missed in PHP 5. Let walkthrough with t...
20 cool features that is in PHP 7, we missed in PHP 5. Let walkthrough with t...20 cool features that is in PHP 7, we missed in PHP 5. Let walkthrough with t...
20 cool features that is in PHP 7, we missed in PHP 5. Let walkthrough with t...DrupalMumbai
 
PHP 7 Crash Course
PHP 7 Crash CoursePHP 7 Crash Course
PHP 7 Crash CourseColin O'Dell
 
PHP 7 Crash Course - php[world] 2015
PHP 7 Crash Course - php[world] 2015PHP 7 Crash Course - php[world] 2015
PHP 7 Crash Course - php[world] 2015Colin O'Dell
 
Php 5.6 From the Inside Out
Php 5.6 From the Inside OutPhp 5.6 From the Inside Out
Php 5.6 From the Inside OutFerenc Kovács
 
PhpSpec: practical introduction
PhpSpec: practical introductionPhpSpec: practical introduction
PhpSpec: practical introductionDave Hulbert
 
The why and how of moving to php 7
The why and how of moving to php 7The why and how of moving to php 7
The why and how of moving to php 7Wim Godden
 
Introduction to c first week slides
Introduction to c first week slidesIntroduction to c first week slides
Introduction to c first week slidesluqman bawany
 
The why and how of moving to php 8
The why and how of moving to php 8The why and how of moving to php 8
The why and how of moving to php 8Wim Godden
 
What To Expect From PHP7
What To Expect From PHP7What To Expect From PHP7
What To Expect From PHP7Codemotion
 
Embrace dynamic PHP
Embrace dynamic PHPEmbrace dynamic PHP
Embrace dynamic PHPPaul Houle
 
Introduction to Go language
Introduction to Go languageIntroduction to Go language
Introduction to Go languageTzar Umang
 

Similar to Learning php 7 (20)

PHP 7X New Features
PHP 7X New FeaturesPHP 7X New Features
PHP 7X New Features
 
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
 
The why and how of moving to php 7.x
The why and how of moving to php 7.xThe why and how of moving to php 7.x
The why and how of moving to php 7.x
 
The why and how of moving to php 7.x
The why and how of moving to php 7.xThe 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...
20 cool features that is in PHP 7, we missed in PHP 5. Let walkthrough with t...20 cool features that is in PHP 7, we missed in PHP 5. Let walkthrough with t...
20 cool features that is in PHP 7, we missed in PHP 5. Let walkthrough with t...
 
Php 7 crash course
Php 7 crash coursePhp 7 crash course
Php 7 crash course
 
PHP 7 Crash Course
PHP 7 Crash CoursePHP 7 Crash Course
PHP 7 Crash Course
 
PHP 7 Crash Course - php[world] 2015
PHP 7 Crash Course - php[world] 2015PHP 7 Crash Course - php[world] 2015
PHP 7 Crash Course - php[world] 2015
 
Php 5.6 From the Inside Out
Php 5.6 From the Inside OutPhp 5.6 From the Inside Out
Php 5.6 From the Inside Out
 
PhpSpec: practical introduction
PhpSpec: practical introductionPhpSpec: practical introduction
PhpSpec: practical introduction
 
Php 7 - YNS
Php 7 - YNSPhp 7 - YNS
Php 7 - YNS
 
The why and how of moving to php 7
The why and how of moving to php 7The why and how of moving to php 7
The why and how of moving to php 7
 
Core java
Core javaCore java
Core java
 
PHP7: Hello World!
PHP7: Hello World!PHP7: Hello World!
PHP7: Hello World!
 
Introduction to c first week slides
Introduction to c first week slidesIntroduction to c first week slides
Introduction to c first week slides
 
The why and how of moving to php 8
The why and how of moving to php 8The why and how of moving to php 8
The why and how of moving to php 8
 
What To Expect From PHP7
What To Expect From PHP7What To Expect From PHP7
What To Expect From PHP7
 
Embrace dynamic PHP
Embrace dynamic PHPEmbrace dynamic PHP
Embrace dynamic PHP
 
14274730 (1).ppt
14274730 (1).ppt14274730 (1).ppt
14274730 (1).ppt
 
Introduction to Go language
Introduction to Go languageIntroduction to Go language
Introduction to Go language
 

Recently uploaded

Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphNeo4j
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxOnBoard
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
Azure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAzure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAndikSusilo4
 

Recently uploaded (20)

Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
Transcript: #StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food Manufacturing
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptx
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
Azure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & ApplicationAzure Monitor & Application Insight to monitor Infrastructure & Application
Azure Monitor & Application Insight to monitor Infrastructure & Application
 

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