SlideShare ist ein Scribd-Unternehmen logo
1 von 39
PHP 7
PHP 5.6
• Currently stable version
• Last Version of 5.x branch
• Common widely version use
PHP 7
• PHP 7 was released on Dec 3, 2015
• First major version since PHP 5.0 in 2004
• PHP 6 was abandoned in 2010
• PHP 7 is powered by a new engine PHPNG
PHP 7 is 2x Fast!
0
0.5
1
1.5
2
2.5
PHP Versions
Response Speed
PHP 5.3 PHP 5.4 PHP 5.5 PHP 5.6 PHP 5.7
Why PHP 7 is Fast?
• Grew from the phpng project
• Influenced by HHVM/Hack lang
• Major refactoring of the Zend Engine
• More compact data structure throughout
• http://talks.php.net/fluent15#/6
New Features
• Improved performance − Having PHPNG code merged in PHP7, it is
twice as fast as PHP 5.
• Lower Memory Consumption − Optimized PHP 7 utilizes lesser resource.
• Scalar type declarations − Now parameter and return types can be
enforced.
• Many fatal errors converted to Exceptions − Range of exceptions is
increased covering many fatal error converted as exceptions.
New Features
• Secure random number generator − Addition of new secure random number
generator API.
• Deprecated SAPIs and extensions removed − Various old and unsupported
SAPIs and extensions are removed from the latest version.
• The null coalescing operator (??) − New null coalescing operator added.
• Return and Scalar Type Declarations − Support for return type and parameter
type added.
• Anonymous Classes − Support for anonymous added.
New Features
• PHP 7 uses new Zend Engine 3.0 to improve application performance
almost twice and 50% better memory consumption than PHP 5.6. It allows
to serve more concurrent users without requiring any additional hardware.
PHP 7 is designed and refactored considering today's workloads.
Scalar Type Declarations
In PHP 7, a new feature, Scalar type declarations, has been introduced.
Scalar type declaration has two options
• coercive - coercive is default mode and need not to be specified.
• strict - strict mode has to explicitly hinted.
Scalar Type Declarations
Following types for function parameters can be enforced using the modes
• int
• float
• bool
• string
• interfaces
• array
• callable
Example - Coercive Mode
Example - Strict Mode
Return Type Declarations
• In PHP 7, a new feature, Return type declarations has been introduced.
Return type declaration specifies the type of value that a function should
return. Following types for return types can be declared.
Example - Valid Return Type
Example - Invalid Return Type
Null Coalescing Operator
• In PHP 7, a new feature, null coalescing operator (??) has been
introduced. It is used to replace the ternary operation in conjunction with
isset() function. The Null coalescing operator returns its first operand if it
exists and is not NULL; otherwise it returns its second operand.
Example
Spaceship Operator
• In PHP 7, a new feature, spaceship operator has been introduced. It is used
to compare two expressions. It returns -1, 0 or 1 when first expression is
respectively less than, equal to, or greater than second expression.
Example
Constant Arrays
• Array constants can now be defined using the define() function. In PHP 5.6,
they could only be defined using const keyword.
Example
Anonymous Classes
• Anonymous classes can now be defined using new class. Anonymous class
can be used in place of a full class definition.
Example – Normal class
Example – Anonymous class
use Statement
• From PHP7 onwards, a single use statement can be used to import Classes,
functions and constants from same namespace instead of multiple use
statements.
Example
Error Handling
Integer Division
• PHP 7 introduces a new function intdiv(), which performs integer division
of its operands and return the division as int.
Example
Session Options
• From PHP7+, session_start() function accepts an array of options to
override the session configuration directives set in php.ini. These options
supportssession.lazy_write, which is by default on and causes PHP to
overwrite any session file if the session data has changed.
• Another option added is read_and_close, which indicates that the session
data should be read and then the session should immediately be closed
unchanged. For example, Set session.cache_limiter to private and set the
flag to close the session immediately after reading it, using the following code
snippet.
Example
CSPRNG
• In PHP 7, following two new functions are introduced to generate
cryptographically secure I
• random_bytes() − Generates cryptographically secure pseudo-random
bytes.ntegers and strings in a cross platform way.
• random_int() − Generates cryptographically secure pseudo-random
integers.
Syntax
• string random_bytes ( int $length ) // Random Bytes
• int random_int ( int $min , int $max ) // Random integer
Deprecated Features
• style constructors
• Static calls to non-static methods
• password_hash() salt option
Style constructors
Static calls to non-static methods
Removed Extensions & SAPIs
Following Extensions have been removed from PHP 7 onwards
• ereg
• mssql
• mysql
• sybase_ct
Removed SAPIs
• Aolserver
• apache
• apache_hooks
• apache2filter
• caudium
• continuity
• Isapi
• milter
• phttpd
• pi3web
• roxen
• thttpd
• tux
• webjames
Php 7 - YNS

Weitere ähnliche Inhalte

Was ist angesagt?

Php under the_hood
Php under the_hoodPhp under the_hood
Php under the_hoodfrank_neff
 
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
 
9780538745840 ppt ch01 PHP
9780538745840 ppt ch01 PHP9780538745840 ppt ch01 PHP
9780538745840 ppt ch01 PHPTerry Yoast
 
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
 
2021.laravelconf.tw.slides2
2021.laravelconf.tw.slides22021.laravelconf.tw.slides2
2021.laravelconf.tw.slides2LiviaLiaoFontech
 
Preprocessor directives in c language
Preprocessor directives in c languagePreprocessor directives in c language
Preprocessor directives in c languagetanmaymodi4
 
PhpSpec: practical introduction
PhpSpec: practical introductionPhpSpec: practical introduction
PhpSpec: practical introductionDave Hulbert
 
How PHP Works ?
How PHP Works ?How PHP Works ?
How PHP Works ?Ravi Raj
 
Planet of the AOPs
Planet of the AOPsPlanet of the AOPs
Planet of the AOPsJames Ward
 
Php extensions workshop
Php extensions workshopPhp extensions workshop
Php extensions workshopjulien pauli
 
Concurrency & Parallel Programming
Concurrency & Parallel ProgrammingConcurrency & Parallel Programming
Concurrency & Parallel ProgrammingRamazan AYYILDIZ
 
POLITEKNIK MALAYSIA
POLITEKNIK MALAYSIAPOLITEKNIK MALAYSIA
POLITEKNIK MALAYSIAAiman Hud
 
Decision and looping examples with php (WT)
Decision and looping examples with php (WT)Decision and looping examples with php (WT)
Decision and looping examples with php (WT)kunjan shah
 
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
 

Was ist angesagt? (20)

Php under the_hood
Php under the_hoodPhp under the_hood
Php under the_hood
 
Introduction to OpenMP
Introduction to OpenMPIntroduction to OpenMP
Introduction to OpenMP
 
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
 
9780538745840 ppt ch01 PHP
9780538745840 ppt ch01 PHP9780538745840 ppt ch01 PHP
9780538745840 ppt ch01 PHP
 
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...
 
2021.laravelconf.tw.slides2
2021.laravelconf.tw.slides22021.laravelconf.tw.slides2
2021.laravelconf.tw.slides2
 
Openmp
OpenmpOpenmp
Openmp
 
Introduction to OpenMP
Introduction to OpenMPIntroduction to OpenMP
Introduction to OpenMP
 
How PHP works
How PHP works How PHP works
How PHP works
 
Preprocessor directives in c language
Preprocessor directives in c languagePreprocessor directives in c language
Preprocessor directives in c language
 
OpenMP
OpenMPOpenMP
OpenMP
 
PhpSpec: practical introduction
PhpSpec: practical introductionPhpSpec: practical introduction
PhpSpec: practical introduction
 
How PHP Works ?
How PHP Works ?How PHP Works ?
How PHP Works ?
 
Php advance
Php advancePhp advance
Php advance
 
Planet of the AOPs
Planet of the AOPsPlanet of the AOPs
Planet of the AOPs
 
Php extensions workshop
Php extensions workshopPhp extensions workshop
Php extensions workshop
 
Concurrency & Parallel Programming
Concurrency & Parallel ProgrammingConcurrency & Parallel Programming
Concurrency & Parallel Programming
 
POLITEKNIK MALAYSIA
POLITEKNIK MALAYSIAPOLITEKNIK MALAYSIA
POLITEKNIK MALAYSIA
 
Decision and looping examples with php (WT)
Decision and looping examples with php (WT)Decision and looping examples with php (WT)
Decision and looping examples with php (WT)
 
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
 

Andere mochten auch

Andere mochten auch (12)

Cake PHP 3 Presentaion
Cake PHP 3 PresentaionCake PHP 3 Presentaion
Cake PHP 3 Presentaion
 
Software Testing
Software Testing Software Testing
Software Testing
 
System performance tuning
System performance tuningSystem performance tuning
System performance tuning
 
Learning CakePHP2 from source code vol2
Learning CakePHP2 from source code vol2Learning CakePHP2 from source code vol2
Learning CakePHP2 from source code vol2
 
Node js - Yns
Node js - YnsNode js - Yns
Node js - Yns
 
How to create test data
How to create test dataHow to create test data
How to create test data
 
Functional programming
Functional programmingFunctional programming
Functional programming
 
Full-Stack CakePHP Deployment
Full-Stack CakePHP DeploymentFull-Stack CakePHP Deployment
Full-Stack CakePHP Deployment
 
CakePHP Community Keynote 2014
CakePHP Community Keynote 2014CakePHP Community Keynote 2014
CakePHP Community Keynote 2014
 
CakePHP
CakePHPCakePHP
CakePHP
 
Cakephp
CakephpCakephp
Cakephp
 
WordPress APIで作るモバイルアプリ
WordPress APIで作るモバイルアプリWordPress APIで作るモバイルアプリ
WordPress APIで作るモバイルアプリ
 

Ähnlich wie Php 7 - YNS

Php5 vs php7
Php5 vs php7Php5 vs php7
Php5 vs php7gentlex2
 
Workshop: Refactoring Legacy PHP: The Complete Guide
Workshop: Refactoring Legacy PHP: The Complete Guide Workshop: Refactoring Legacy PHP: The Complete Guide
Workshop: Refactoring Legacy PHP: The Complete Guide Junade Ali
 
Php7 extensions workshop
Php7 extensions workshopPhp7 extensions workshop
Php7 extensions workshopjulien pauli
 
PHP 7 Crash Course
PHP 7 Crash CoursePHP 7 Crash Course
PHP 7 Crash CourseColin O'Dell
 
Extending ZF & Extending With ZF
Extending ZF & Extending With ZFExtending ZF & Extending With ZF
Extending ZF & Extending With ZFRalph Schindler
 
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 mysql classes in navi-mumbai,php-mysql course provider-in-navi-mumbai,bes...
Php mysql classes in navi-mumbai,php-mysql course provider-in-navi-mumbai,bes...Php mysql classes in navi-mumbai,php-mysql course provider-in-navi-mumbai,bes...
Php mysql classes in navi-mumbai,php-mysql course provider-in-navi-mumbai,bes...anshkhurana01
 
PHP 5.6 New and Deprecated Features
PHP 5.6  New and Deprecated FeaturesPHP 5.6  New and Deprecated Features
PHP 5.6 New and Deprecated FeaturesMark Niebergall
 
Php7 傳說中的第七隻大象
Php7 傳說中的第七隻大象Php7 傳說中的第七隻大象
Php7 傳說中的第七隻大象bobo52310
 
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 tutorial from_beginner_to_master
Php tutorial from_beginner_to_masterPhp tutorial from_beginner_to_master
Php tutorial from_beginner_to_masterPrinceGuru MS
 
Last Month in PHP - June 2016
Last Month in PHP - June 2016Last Month in PHP - June 2016
Last Month in PHP - June 2016Eric Poe
 

Ähnlich wie Php 7 - YNS (20)

Php5 vs php7
Php5 vs php7Php5 vs php7
Php5 vs php7
 
Php7
Php7Php7
Php7
 
Workshop: Refactoring Legacy PHP: The Complete Guide
Workshop: Refactoring Legacy PHP: The Complete Guide Workshop: Refactoring Legacy PHP: The Complete Guide
Workshop: Refactoring Legacy PHP: The Complete Guide
 
Php7 extensions workshop
Php7 extensions workshopPhp7 extensions workshop
Php7 extensions workshop
 
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
 
Extending ZF & Extending With ZF
Extending ZF & Extending With ZFExtending ZF & Extending With ZF
Extending ZF & Extending With ZF
 
Php intro
Php introPhp intro
Php intro
 
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
 
Download It
Download ItDownload It
Download It
 
Php mysql classes in navi-mumbai,php-mysql course provider-in-navi-mumbai,bes...
Php mysql classes in navi-mumbai,php-mysql course provider-in-navi-mumbai,bes...Php mysql classes in navi-mumbai,php-mysql course provider-in-navi-mumbai,bes...
Php mysql classes in navi-mumbai,php-mysql course provider-in-navi-mumbai,bes...
 
Learning php 7
Learning php 7Learning php 7
Learning php 7
 
Basics PHP
Basics PHPBasics PHP
Basics PHP
 
Start using PHP 7
Start using PHP 7Start using PHP 7
Start using PHP 7
 
PHP 5.6 New and Deprecated Features
PHP 5.6  New and Deprecated FeaturesPHP 5.6  New and Deprecated Features
PHP 5.6 New and Deprecated Features
 
Guidelines php 8 gig
Guidelines php 8 gigGuidelines php 8 gig
Guidelines php 8 gig
 
Php7 傳說中的第七隻大象
Php7 傳說中的第七隻大象Php7 傳說中的第七隻大象
Php7 傳說中的第七隻大象
 
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 tutorial from_beginner_to_master
Php tutorial from_beginner_to_masterPhp tutorial from_beginner_to_master
Php tutorial from_beginner_to_master
 
Last Month in PHP - June 2016
Last Month in PHP - June 2016Last Month in PHP - June 2016
Last Month in PHP - June 2016
 

Kürzlich hochgeladen

Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3JemimahLaneBuaron
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformChameera Dedduwage
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxNirmalaLoungPoorunde1
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdfQucHHunhnh
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphThiyagu K
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxSayali Powar
 
Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesFatimaKhan178732
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Educationpboyjonauth
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptxVS Mahajan Coaching Centre
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityGeoBlogs
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionSafetyChain Software
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeThiyagu K
 
Hybridoma Technology ( Production , Purification , and Application )
Hybridoma Technology  ( Production , Purification , and Application  ) Hybridoma Technology  ( Production , Purification , and Application  )
Hybridoma Technology ( Production , Purification , and Application ) Sakshi Ghasle
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactdawncurless
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactPECB
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfJayanti Pande
 

Kürzlich hochgeladen (20)

Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy Reform
 
Staff of Color (SOC) Retention Efforts DDSD
Staff of Color (SOC) Retention Efforts DDSDStaff of Color (SOC) Retention Efforts DDSD
Staff of Color (SOC) Retention Efforts DDSD
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptx
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot Graph
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
 
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
 
Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and Actinides
 
Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Education
 
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptxINDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activity
 
Mastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory InspectionMastering the Unannounced Regulatory Inspection
Mastering the Unannounced Regulatory Inspection
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 
Hybridoma Technology ( Production , Purification , and Application )
Hybridoma Technology  ( Production , Purification , and Application  ) Hybridoma Technology  ( Production , Purification , and Application  )
Hybridoma Technology ( Production , Purification , and Application )
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdf
 

Php 7 - YNS

  • 2. PHP 5.6 • Currently stable version • Last Version of 5.x branch • Common widely version use
  • 3. PHP 7 • PHP 7 was released on Dec 3, 2015 • First major version since PHP 5.0 in 2004 • PHP 6 was abandoned in 2010 • PHP 7 is powered by a new engine PHPNG
  • 4. PHP 7 is 2x Fast! 0 0.5 1 1.5 2 2.5 PHP Versions Response Speed PHP 5.3 PHP 5.4 PHP 5.5 PHP 5.6 PHP 5.7
  • 5. Why PHP 7 is Fast? • Grew from the phpng project • Influenced by HHVM/Hack lang • Major refactoring of the Zend Engine • More compact data structure throughout • http://talks.php.net/fluent15#/6
  • 6. New Features • Improved performance − Having PHPNG code merged in PHP7, it is twice as fast as PHP 5. • Lower Memory Consumption − Optimized PHP 7 utilizes lesser resource. • Scalar type declarations − Now parameter and return types can be enforced. • Many fatal errors converted to Exceptions − Range of exceptions is increased covering many fatal error converted as exceptions.
  • 7. New Features • Secure random number generator − Addition of new secure random number generator API. • Deprecated SAPIs and extensions removed − Various old and unsupported SAPIs and extensions are removed from the latest version. • The null coalescing operator (??) − New null coalescing operator added. • Return and Scalar Type Declarations − Support for return type and parameter type added. • Anonymous Classes − Support for anonymous added.
  • 8. New Features • PHP 7 uses new Zend Engine 3.0 to improve application performance almost twice and 50% better memory consumption than PHP 5.6. It allows to serve more concurrent users without requiring any additional hardware. PHP 7 is designed and refactored considering today's workloads.
  • 9. Scalar Type Declarations In PHP 7, a new feature, Scalar type declarations, has been introduced. Scalar type declaration has two options • coercive - coercive is default mode and need not to be specified. • strict - strict mode has to explicitly hinted.
  • 10. Scalar Type Declarations Following types for function parameters can be enforced using the modes • int • float • bool • string • interfaces • array • callable
  • 13. Return Type Declarations • In PHP 7, a new feature, Return type declarations has been introduced. Return type declaration specifies the type of value that a function should return. Following types for return types can be declared.
  • 14. Example - Valid Return Type
  • 15. Example - Invalid Return Type
  • 16. Null Coalescing Operator • In PHP 7, a new feature, null coalescing operator (??) has been introduced. It is used to replace the ternary operation in conjunction with isset() function. The Null coalescing operator returns its first operand if it exists and is not NULL; otherwise it returns its second operand.
  • 18. Spaceship Operator • In PHP 7, a new feature, spaceship operator has been introduced. It is used to compare two expressions. It returns -1, 0 or 1 when first expression is respectively less than, equal to, or greater than second expression.
  • 20. Constant Arrays • Array constants can now be defined using the define() function. In PHP 5.6, they could only be defined using const keyword.
  • 22. Anonymous Classes • Anonymous classes can now be defined using new class. Anonymous class can be used in place of a full class definition.
  • 25. use Statement • From PHP7 onwards, a single use statement can be used to import Classes, functions and constants from same namespace instead of multiple use statements.
  • 28. Integer Division • PHP 7 introduces a new function intdiv(), which performs integer division of its operands and return the division as int.
  • 30. Session Options • From PHP7+, session_start() function accepts an array of options to override the session configuration directives set in php.ini. These options supportssession.lazy_write, which is by default on and causes PHP to overwrite any session file if the session data has changed. • Another option added is read_and_close, which indicates that the session data should be read and then the session should immediately be closed unchanged. For example, Set session.cache_limiter to private and set the flag to close the session immediately after reading it, using the following code snippet.
  • 32. CSPRNG • In PHP 7, following two new functions are introduced to generate cryptographically secure I • random_bytes() − Generates cryptographically secure pseudo-random bytes.ntegers and strings in a cross platform way. • random_int() − Generates cryptographically secure pseudo-random integers.
  • 33. Syntax • string random_bytes ( int $length ) // Random Bytes • int random_int ( int $min , int $max ) // Random integer
  • 34. Deprecated Features • style constructors • Static calls to non-static methods • password_hash() salt option
  • 36. Static calls to non-static methods
  • 37. Removed Extensions & SAPIs Following Extensions have been removed from PHP 7 onwards • ereg • mssql • mysql • sybase_ct
  • 38. Removed SAPIs • Aolserver • apache • apache_hooks • apache2filter • caudium • continuity • Isapi • milter • phttpd • pi3web • roxen • thttpd • tux • webjames