SlideShare une entreprise Scribd logo
1  sur  19
Télécharger pour lire hors ligne
WHAT'S NEW IN PHP 5.5
·Corey Ballou @cballou
GENERATORS
Support for generators has been added via the yield keyword
range(0, 1000000)vs. user supplied function
EXAMPLE USAGE OF YIELD KEYWORD
function getLines($filepath) {
$f = fopen($filepath, 'r');
try {
while ($line = fgets($f)) {
yield $line;
}
} finally {
fclose($f);
}
}
foreach (getLines("file.txt") as $n => $line) {
echo $line;
}
THE "FINALLY" KEYWORD IS FINALLY HERE
Execute code ALWAYS.
try {
throw new Exception('hello');
} catch (Exception $e) {
echo $e->getMessage();
} finally {
// this code will always be run
echo ', world';
}
PASSWORD HASHING API
A super easy library that uses underlying crypt library.
password_get_info()
password_hash()
password_needs_rehash()
password_verify()
EXAMPLE OF REGISTER/LOGIN
function register($username, $password) {
$hash = password_hash($password, PASSWORD_BCRYPT);
// save hash to database
}
function login($username, $password) {
$hash = getHashFromDbByUsername($username);
if (password_verify($password, $hash)) {
// perform login (store session var)
return true;
}
return false;
}
INCREASING PASSWORD SECURITY
You can optionally supply your own salt and algorithmic cost.
function register($username, $password) {
$options = array('salt' => 'someRandomSalt', 'cost' => 12);
$hash = password_hash($password, PASSWORD_BCRYPT, $options);
// save hash to database
}
EXAMPLE OF UPGRADING YOUR HASHING
ALGORITHM
function login($username, $password) {
$hash = getHashFromDbByUsername($username);
if (password_verify($password, $hash)) {
// check if hash is in updated format
if (password_needs_rehash($hash, PASSWORD_BCRYPT)) {
// perform update
$hash = password_hash($password, PASSWORD_BCRYPT);
// save new hash to database
}
// perform login (store session var)
return true;
}
return false;
}
FOREACH + LIST
$array = [
[1, 2],
[3, 4],
];
foreach ($array as list($a, $b)) {
echo "A: $a; B: $bn";
}
ARRAY_COLUMN()FUN
$people = [
[
'firstname' => 'John',
'lastname' => 'Doe'
],
[
'firstname' => 'Jane',
'lastname' => 'Doe'
],
];
// contains [ 0 => 'John', 1 => 'Jane' ]
$firstnames = array_column($people, 'firstname');
IMPROVEMENTS TO EMPTY()
function always_false() {
return false;
}
if (empty(always_false())) {
echo "Hello, world.";
}
ARRAY AND STRING LITERAL DEREFERENCING
// array dereferencing
echo [1, 2, 3][0];
// string dereferencing
echo 'PHP'[0];
NOW LET'S REALLY GET CRAZY...
function foo() {
return array(1, 2, 3);
}
echo foo()[2]; // prints 3
$func = function() { return array('a', 'b', 'c'); };
echo $func()[0]; // prints a
ZEND OPTIMISER+ OPCACHE EXTENSION
Not a replacement for APC/memcache(d). No user cache!
Available in PHP 5.4 via install.
Source available: https://github.com/zend-
dev/ZendOptimizerPlus
$ php -v
PHP 5.4.17RC1 (cli) (built: Jun 22 2013 19:27:26)
Copyright (c) 1997-2013 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2013 Zend Technologies
with Zend OPcache v7.0.2, Copyright (c) 1999-2013, by Zend Technolo
gies
SO, UH, WHAT IS AN OPCODE CACHE?
Component designed to speed up performance of PHP
without altering the app.
Overrides PHP's default compiler callback by checking if a
compiled intermediate-code version of the code is
available in-memory.
It skips compilation when it can!
WHAT TO DO ABOUT DEPRECATED APC
MODULE?
APC User Cache is in the works:
APC minus the opcode cache!
github.com/krakjoe/apcu
BACKWARDS INCOMPATIBLE CHANGES
Win XP/2003 support dropped
self, parent and static are case insensitive
pack()and unpack()made more compatible with perl
http://www.php.net/manual/en/migration55.deprecated.php
CREDITS
php.net - What has changed in PHP 5.5.x
wiki.php.net - Integrating Zend Optimizer+ into the PHP
distribution
schlueters.de - Features in PHP trunk: Array
dereferencing
slideshare.net - What's new in PHP 5.5
stackoverflow.com - How do you use bcrypt for hashing
passwords in PHP?
QUESTIONS? COMMENTS?
Thanks for pretending to enjoy my banter!

Contenu connexe

Tendances

The Browser Environment - A Systems Programmer's Perspective
The Browser Environment - A Systems Programmer's PerspectiveThe Browser Environment - A Systems Programmer's Perspective
The Browser Environment - A Systems Programmer's PerspectiveEleanor McHugh
 
PHP Tips for certification - OdW13
PHP Tips for certification - OdW13PHP Tips for certification - OdW13
PHP Tips for certification - OdW13julien pauli
 
Debugging: Rules And Tools - PHPTek 11 Version
Debugging: Rules And Tools - PHPTek 11 VersionDebugging: Rules And Tools - PHPTek 11 Version
Debugging: Rules And Tools - PHPTek 11 VersionIan Barber
 
Diving into HHVM Extensions (php[tek] 2016)
Diving into HHVM Extensions (php[tek] 2016)Diving into HHVM Extensions (php[tek] 2016)
Diving into HHVM Extensions (php[tek] 2016)James Titcumb
 
Teaching Your Machine To Find Fraudsters
Teaching Your Machine To Find FraudstersTeaching Your Machine To Find Fraudsters
Teaching Your Machine To Find FraudstersIan Barber
 
Quick tour of PHP from inside
Quick tour of PHP from insideQuick tour of PHP from inside
Quick tour of PHP from insidejulien pauli
 
Shell实现的windows回收站功能的脚本
Shell实现的windows回收站功能的脚本Shell实现的windows回收站功能的脚本
Shell实现的windows回收站功能的脚本Lingfei Kong
 
How to stand on the shoulders of giants
How to stand on the shoulders of giantsHow to stand on the shoulders of giants
How to stand on the shoulders of giantsIan Barber
 
Using the Power to Prove
Using the Power to ProveUsing the Power to Prove
Using the Power to ProveKazuho Oku
 
Go for the paranoid network programmer, 3rd edition
Go for the paranoid network programmer, 3rd editionGo for the paranoid network programmer, 3rd edition
Go for the paranoid network programmer, 3rd editionEleanor McHugh
 
The Browser Environment - A Systems Programmer's Perspective [sinatra edition]
The Browser Environment - A Systems Programmer's Perspective [sinatra edition]The Browser Environment - A Systems Programmer's Perspective [sinatra edition]
The Browser Environment - A Systems Programmer's Perspective [sinatra edition]Eleanor McHugh
 
Advanced modulinos
Advanced modulinosAdvanced modulinos
Advanced modulinosbrian d foy
 
Advanced modulinos trial
Advanced modulinos trialAdvanced modulinos trial
Advanced modulinos trialbrian d foy
 
Creating own language made easy
Creating own language made easyCreating own language made easy
Creating own language made easyIngvar Stepanyan
 
Trading with opensource tools, two years later
Trading with opensource tools, two years laterTrading with opensource tools, two years later
Trading with opensource tools, two years laterclkao
 
Unix Programming with Perl
Unix Programming with PerlUnix Programming with Perl
Unix Programming with PerlKazuho Oku
 

Tendances (20)

The Browser Environment - A Systems Programmer's Perspective
The Browser Environment - A Systems Programmer's PerspectiveThe Browser Environment - A Systems Programmer's Perspective
The Browser Environment - A Systems Programmer's Perspective
 
PHP Tips for certification - OdW13
PHP Tips for certification - OdW13PHP Tips for certification - OdW13
PHP Tips for certification - OdW13
 
Functional programming with php7
Functional programming with php7Functional programming with php7
Functional programming with php7
 
Debugging: Rules And Tools - PHPTek 11 Version
Debugging: Rules And Tools - PHPTek 11 VersionDebugging: Rules And Tools - PHPTek 11 Version
Debugging: Rules And Tools - PHPTek 11 Version
 
Diving into HHVM Extensions (php[tek] 2016)
Diving into HHVM Extensions (php[tek] 2016)Diving into HHVM Extensions (php[tek] 2016)
Diving into HHVM Extensions (php[tek] 2016)
 
Teaching Your Machine To Find Fraudsters
Teaching Your Machine To Find FraudstersTeaching Your Machine To Find Fraudsters
Teaching Your Machine To Find Fraudsters
 
Quick tour of PHP from inside
Quick tour of PHP from insideQuick tour of PHP from inside
Quick tour of PHP from inside
 
Introduction to Perl Programming
Introduction to Perl ProgrammingIntroduction to Perl Programming
Introduction to Perl Programming
 
Shell实现的windows回收站功能的脚本
Shell实现的windows回收站功能的脚本Shell实现的windows回收站功能的脚本
Shell实现的windows回收站功能的脚本
 
How to stand on the shoulders of giants
How to stand on the shoulders of giantsHow to stand on the shoulders of giants
How to stand on the shoulders of giants
 
Using the Power to Prove
Using the Power to ProveUsing the Power to Prove
Using the Power to Prove
 
Go for the paranoid network programmer, 3rd edition
Go for the paranoid network programmer, 3rd editionGo for the paranoid network programmer, 3rd edition
Go for the paranoid network programmer, 3rd edition
 
Elixir cheatsheet
Elixir cheatsheetElixir cheatsheet
Elixir cheatsheet
 
The Browser Environment - A Systems Programmer's Perspective [sinatra edition]
The Browser Environment - A Systems Programmer's Perspective [sinatra edition]The Browser Environment - A Systems Programmer's Perspective [sinatra edition]
The Browser Environment - A Systems Programmer's Perspective [sinatra edition]
 
Advanced modulinos
Advanced modulinosAdvanced modulinos
Advanced modulinos
 
Advanced modulinos trial
Advanced modulinos trialAdvanced modulinos trial
Advanced modulinos trial
 
Creating own language made easy
Creating own language made easyCreating own language made easy
Creating own language made easy
 
Trading with opensource tools, two years later
Trading with opensource tools, two years laterTrading with opensource tools, two years later
Trading with opensource tools, two years later
 
Unix Programming with Perl
Unix Programming with PerlUnix Programming with Perl
Unix Programming with Perl
 
Perl IO
Perl IOPerl IO
Perl IO
 

En vedette

Root cause analysis of RF amplifier gain failures
Root cause analysis of RF amplifier gain failuresRoot cause analysis of RF amplifier gain failures
Root cause analysis of RF amplifier gain failuressstockbridge
 
Introducing phpMyBootstrap
Introducing phpMyBootstrapIntroducing phpMyBootstrap
Introducing phpMyBootstrapRod Linguri
 
โกงกางพรรณไม้ชายเลน
โกงกางพรรณไม้ชายเลนโกงกางพรรณไม้ชายเลน
โกงกางพรรณไม้ชายเลนChinnapat Kumphan
 
Strain gauge calibration machine
Strain gauge calibration machineStrain gauge calibration machine
Strain gauge calibration machinesstockbridge
 
Demand and supply factors
Demand and supply factorsDemand and supply factors
Demand and supply factorsDeepak Kumar
 
SDIN 2016 | Orchestrating ‘Strategic Coupling’: A Shared, Place-Based Leaders...
SDIN 2016 | Orchestrating ‘Strategic Coupling’: A Shared, Place-Based Leaders...SDIN 2016 | Orchestrating ‘Strategic Coupling’: A Shared, Place-Based Leaders...
SDIN 2016 | Orchestrating ‘Strategic Coupling’: A Shared, Place-Based Leaders...Miranda Ebbekink
 
president house of india
president house of indiapresident house of india
president house of indiaDeepak Kumar
 
Inheritance chapter-6-computer-science-with-c++ opt
Inheritance chapter-6-computer-science-with-c++ optInheritance chapter-6-computer-science-with-c++ opt
Inheritance chapter-6-computer-science-with-c++ optdeepakskb2013
 
Management by objective
Management by objectiveManagement by objective
Management by objectiveDeepak Kumar
 
gebruik-nieuwe-machtsbronnen-als-relatie-kennis-en-overtuigingskracht
gebruik-nieuwe-machtsbronnen-als-relatie-kennis-en-overtuigingskrachtgebruik-nieuwe-machtsbronnen-als-relatie-kennis-en-overtuigingskracht
gebruik-nieuwe-machtsbronnen-als-relatie-kennis-en-overtuigingskrachtMiranda Ebbekink
 

En vedette (14)

Root cause analysis of RF amplifier gain failures
Root cause analysis of RF amplifier gain failuresRoot cause analysis of RF amplifier gain failures
Root cause analysis of RF amplifier gain failures
 
Introducing phpMyBootstrap
Introducing phpMyBootstrapIntroducing phpMyBootstrap
Introducing phpMyBootstrap
 
โกงกางพรรณไม้ชายเลน
โกงกางพรรณไม้ชายเลนโกงกางพรรณไม้ชายเลน
โกงกางพรรณไม้ชายเลน
 
Roland dg
Roland dgRoland dg
Roland dg
 
Compo 1
Compo 1Compo 1
Compo 1
 
Strain gauge calibration machine
Strain gauge calibration machineStrain gauge calibration machine
Strain gauge calibration machine
 
Demand and supply factors
Demand and supply factorsDemand and supply factors
Demand and supply factors
 
Campaña
Campaña Campaña
Campaña
 
SDIN 2016 | Orchestrating ‘Strategic Coupling’: A Shared, Place-Based Leaders...
SDIN 2016 | Orchestrating ‘Strategic Coupling’: A Shared, Place-Based Leaders...SDIN 2016 | Orchestrating ‘Strategic Coupling’: A Shared, Place-Based Leaders...
SDIN 2016 | Orchestrating ‘Strategic Coupling’: A Shared, Place-Based Leaders...
 
president house of india
president house of indiapresident house of india
president house of india
 
ADVERTISING
ADVERTISINGADVERTISING
ADVERTISING
 
Inheritance chapter-6-computer-science-with-c++ opt
Inheritance chapter-6-computer-science-with-c++ optInheritance chapter-6-computer-science-with-c++ opt
Inheritance chapter-6-computer-science-with-c++ opt
 
Management by objective
Management by objectiveManagement by objective
Management by objective
 
gebruik-nieuwe-machtsbronnen-als-relatie-kennis-en-overtuigingskracht
gebruik-nieuwe-machtsbronnen-als-relatie-kennis-en-overtuigingskrachtgebruik-nieuwe-machtsbronnen-als-relatie-kennis-en-overtuigingskracht
gebruik-nieuwe-machtsbronnen-als-relatie-kennis-en-overtuigingskracht
 

Similaire à What's New in PHP 5.5

Introducing PHP Latest Updates
Introducing PHP Latest UpdatesIntroducing PHP Latest Updates
Introducing PHP Latest UpdatesIftekhar Eather
 
Can't Miss Features of PHP 5.3 and 5.4
Can't Miss Features of PHP 5.3 and 5.4Can't Miss Features of PHP 5.3 and 5.4
Can't Miss Features of PHP 5.3 and 5.4Jeff Carouth
 
Introduction to PHP
Introduction to PHPIntroduction to PHP
Introduction to PHPBradley Holt
 
08 Advanced PHP #burningkeyboards
08 Advanced PHP #burningkeyboards08 Advanced PHP #burningkeyboards
08 Advanced PHP #burningkeyboardsDenis Ristic
 
SPL: The Missing Link in Development
SPL: The Missing Link in DevelopmentSPL: The Missing Link in Development
SPL: The Missing Link in Developmentjsmith92
 
The Origin of Lithium
The Origin of LithiumThe Origin of Lithium
The Origin of LithiumNate Abele
 
Good Evils In Perl (Yapc Asia)
Good Evils In Perl (Yapc Asia)Good Evils In Perl (Yapc Asia)
Good Evils In Perl (Yapc Asia)Kang-min Liu
 
PHP Conference Asia 2016
PHP Conference Asia 2016PHP Conference Asia 2016
PHP Conference Asia 2016Britta Alex
 
Orlando BarCamp Why Javascript Doesn't Suck
Orlando BarCamp Why Javascript Doesn't SuckOrlando BarCamp Why Javascript Doesn't Suck
Orlando BarCamp Why Javascript Doesn't Suckerockendude
 
PHP 5.3 Overview
PHP 5.3 OverviewPHP 5.3 Overview
PHP 5.3 Overviewjsmith92
 
PHP Workshop Notes
PHP Workshop NotesPHP Workshop Notes
PHP Workshop NotesPamela Fox
 
What's new, what's hot in PHP 5.3
What's new, what's hot in PHP 5.3What's new, what's hot in PHP 5.3
What's new, what's hot in PHP 5.3Jeremy Coates
 
GettingStartedWithPHP
GettingStartedWithPHPGettingStartedWithPHP
GettingStartedWithPHPNat Weerawan
 
Jsphp 110312161301-phpapp02
Jsphp 110312161301-phpapp02Jsphp 110312161301-phpapp02
Jsphp 110312161301-phpapp02Seri Moth
 
SymfonyCon 2017 php7 performances
SymfonyCon 2017 php7 performancesSymfonyCon 2017 php7 performances
SymfonyCon 2017 php7 performancesjulien pauli
 
[PL] Jak nie zostać "programistą" PHP?
[PL] Jak nie zostać "programistą" PHP?[PL] Jak nie zostać "programistą" PHP?
[PL] Jak nie zostać "programistą" PHP?Radek Benkel
 

Similaire à What's New in PHP 5.5 (20)

Introducing PHP Latest Updates
Introducing PHP Latest UpdatesIntroducing PHP Latest Updates
Introducing PHP Latest Updates
 
Can't Miss Features of PHP 5.3 and 5.4
Can't Miss Features of PHP 5.3 and 5.4Can't Miss Features of PHP 5.3 and 5.4
Can't Miss Features of PHP 5.3 and 5.4
 
Introduction to PHP
Introduction to PHPIntroduction to PHP
Introduction to PHP
 
08 Advanced PHP #burningkeyboards
08 Advanced PHP #burningkeyboards08 Advanced PHP #burningkeyboards
08 Advanced PHP #burningkeyboards
 
SPL: The Missing Link in Development
SPL: The Missing Link in DevelopmentSPL: The Missing Link in Development
SPL: The Missing Link in Development
 
The Origin of Lithium
The Origin of LithiumThe Origin of Lithium
The Origin of Lithium
 
Good Evils In Perl (Yapc Asia)
Good Evils In Perl (Yapc Asia)Good Evils In Perl (Yapc Asia)
Good Evils In Perl (Yapc Asia)
 
PHP Conference Asia 2016
PHP Conference Asia 2016PHP Conference Asia 2016
PHP Conference Asia 2016
 
PHP PPT FILE
PHP PPT FILEPHP PPT FILE
PHP PPT FILE
 
Orlando BarCamp Why Javascript Doesn't Suck
Orlando BarCamp Why Javascript Doesn't SuckOrlando BarCamp Why Javascript Doesn't Suck
Orlando BarCamp Why Javascript Doesn't Suck
 
PHP 5.3 Overview
PHP 5.3 OverviewPHP 5.3 Overview
PHP 5.3 Overview
 
PHP Workshop Notes
PHP Workshop NotesPHP Workshop Notes
PHP Workshop Notes
 
What's new, what's hot in PHP 5.3
What's new, what's hot in PHP 5.3What's new, what's hot in PHP 5.3
What's new, what's hot in PHP 5.3
 
GettingStartedWithPHP
GettingStartedWithPHPGettingStartedWithPHP
GettingStartedWithPHP
 
Jsphp 110312161301-phpapp02
Jsphp 110312161301-phpapp02Jsphp 110312161301-phpapp02
Jsphp 110312161301-phpapp02
 
SymfonyCon 2017 php7 performances
SymfonyCon 2017 php7 performancesSymfonyCon 2017 php7 performances
SymfonyCon 2017 php7 performances
 
PHP7 is coming
PHP7 is comingPHP7 is coming
PHP7 is coming
 
PHP 5.4
PHP 5.4PHP 5.4
PHP 5.4
 
[PL] Jak nie zostać "programistą" PHP?
[PL] Jak nie zostać "programistą" PHP?[PL] Jak nie zostać "programistą" PHP?
[PL] Jak nie zostać "programistą" PHP?
 
Php Tutorials for Beginners
Php Tutorials for BeginnersPhp Tutorials for Beginners
Php Tutorials for Beginners
 

Dernier

Structuring Teams and Portfolios for Success
Structuring Teams and Portfolios for SuccessStructuring Teams and Portfolios for Success
Structuring Teams and Portfolios for SuccessUXDXConf
 
What's New in Teams Calling, Meetings and Devices April 2024
What's New in Teams Calling, Meetings and Devices April 2024What's New in Teams Calling, Meetings and Devices April 2024
What's New in Teams Calling, Meetings and Devices April 2024Stephanie Beckett
 
ERP Contender Series: Acumatica vs. Sage Intacct
ERP Contender Series: Acumatica vs. Sage IntacctERP Contender Series: Acumatica vs. Sage Intacct
ERP Contender Series: Acumatica vs. Sage IntacctBrainSell Technologies
 
FDO for Camera, Sensor and Networking Device – Commercial Solutions from VinC...
FDO for Camera, Sensor and Networking Device – Commercial Solutions from VinC...FDO for Camera, Sensor and Networking Device – Commercial Solutions from VinC...
FDO for Camera, Sensor and Networking Device – Commercial Solutions from VinC...FIDO Alliance
 
Where to Learn More About FDO _ Richard at FIDO Alliance.pdf
Where to Learn More About FDO _ Richard at FIDO Alliance.pdfWhere to Learn More About FDO _ Richard at FIDO Alliance.pdf
Where to Learn More About FDO _ Richard at FIDO Alliance.pdfFIDO Alliance
 
Linux Foundation Edge _ Overview of FDO Software Components _ Randy at Intel.pdf
Linux Foundation Edge _ Overview of FDO Software Components _ Randy at Intel.pdfLinux Foundation Edge _ Overview of FDO Software Components _ Randy at Intel.pdf
Linux Foundation Edge _ Overview of FDO Software Components _ Randy at Intel.pdfFIDO Alliance
 
A Business-Centric Approach to Design System Strategy
A Business-Centric Approach to Design System StrategyA Business-Centric Approach to Design System Strategy
A Business-Centric Approach to Design System StrategyUXDXConf
 
Your enemies use GenAI too - staying ahead of fraud with Neo4j
Your enemies use GenAI too - staying ahead of fraud with Neo4jYour enemies use GenAI too - staying ahead of fraud with Neo4j
Your enemies use GenAI too - staying ahead of fraud with Neo4jNeo4j
 
Extensible Python: Robustness through Addition - PyCon 2024
Extensible Python: Robustness through Addition - PyCon 2024Extensible Python: Robustness through Addition - PyCon 2024
Extensible Python: Robustness through Addition - PyCon 2024Patrick Viafore
 
Easier, Faster, and More Powerful – Alles Neu macht der Mai -Wir durchleuchte...
Easier, Faster, and More Powerful – Alles Neu macht der Mai -Wir durchleuchte...Easier, Faster, and More Powerful – Alles Neu macht der Mai -Wir durchleuchte...
Easier, Faster, and More Powerful – Alles Neu macht der Mai -Wir durchleuchte...panagenda
 
How we scaled to 80K users by doing nothing!.pdf
How we scaled to 80K users by doing nothing!.pdfHow we scaled to 80K users by doing nothing!.pdf
How we scaled to 80K users by doing nothing!.pdfSrushith Repakula
 
TEST BANK For, Information Technology Project Management 9th Edition Kathy Sc...
TEST BANK For, Information Technology Project Management 9th Edition Kathy Sc...TEST BANK For, Information Technology Project Management 9th Edition Kathy Sc...
TEST BANK For, Information Technology Project Management 9th Edition Kathy Sc...marcuskenyatta275
 
Working together SRE & Platform Engineering
Working together SRE & Platform EngineeringWorking together SRE & Platform Engineering
Working together SRE & Platform EngineeringMarcus Vechiato
 
ECS 2024 Teams Premium - Pretty Secure
ECS 2024   Teams Premium - Pretty SecureECS 2024   Teams Premium - Pretty Secure
ECS 2024 Teams Premium - Pretty SecureFemke de Vroome
 
Long journey of Ruby Standard library at RubyKaigi 2024
Long journey of Ruby Standard library at RubyKaigi 2024Long journey of Ruby Standard library at RubyKaigi 2024
Long journey of Ruby Standard library at RubyKaigi 2024Hiroshi SHIBATA
 
Easier, Faster, and More Powerful – Notes Document Properties Reimagined
Easier, Faster, and More Powerful – Notes Document Properties ReimaginedEasier, Faster, and More Powerful – Notes Document Properties Reimagined
Easier, Faster, and More Powerful – Notes Document Properties Reimaginedpanagenda
 
Breaking Down the Flutterwave Scandal What You Need to Know.pdf
Breaking Down the Flutterwave Scandal What You Need to Know.pdfBreaking Down the Flutterwave Scandal What You Need to Know.pdf
Breaking Down the Flutterwave Scandal What You Need to Know.pdfUK Journal
 
AI mind or machine power point presentation
AI mind or machine power point presentationAI mind or machine power point presentation
AI mind or machine power point presentationyogeshlabana357357
 
BT & Neo4j _ How Knowledge Graphs help BT deliver Digital Transformation.pptx
BT & Neo4j _ How Knowledge Graphs help BT deliver Digital Transformation.pptxBT & Neo4j _ How Knowledge Graphs help BT deliver Digital Transformation.pptx
BT & Neo4j _ How Knowledge Graphs help BT deliver Digital Transformation.pptxNeo4j
 

Dernier (20)

Structuring Teams and Portfolios for Success
Structuring Teams and Portfolios for SuccessStructuring Teams and Portfolios for Success
Structuring Teams and Portfolios for Success
 
What's New in Teams Calling, Meetings and Devices April 2024
What's New in Teams Calling, Meetings and Devices April 2024What's New in Teams Calling, Meetings and Devices April 2024
What's New in Teams Calling, Meetings and Devices April 2024
 
ERP Contender Series: Acumatica vs. Sage Intacct
ERP Contender Series: Acumatica vs. Sage IntacctERP Contender Series: Acumatica vs. Sage Intacct
ERP Contender Series: Acumatica vs. Sage Intacct
 
FDO for Camera, Sensor and Networking Device – Commercial Solutions from VinC...
FDO for Camera, Sensor and Networking Device – Commercial Solutions from VinC...FDO for Camera, Sensor and Networking Device – Commercial Solutions from VinC...
FDO for Camera, Sensor and Networking Device – Commercial Solutions from VinC...
 
Where to Learn More About FDO _ Richard at FIDO Alliance.pdf
Where to Learn More About FDO _ Richard at FIDO Alliance.pdfWhere to Learn More About FDO _ Richard at FIDO Alliance.pdf
Where to Learn More About FDO _ Richard at FIDO Alliance.pdf
 
Linux Foundation Edge _ Overview of FDO Software Components _ Randy at Intel.pdf
Linux Foundation Edge _ Overview of FDO Software Components _ Randy at Intel.pdfLinux Foundation Edge _ Overview of FDO Software Components _ Randy at Intel.pdf
Linux Foundation Edge _ Overview of FDO Software Components _ Randy at Intel.pdf
 
A Business-Centric Approach to Design System Strategy
A Business-Centric Approach to Design System StrategyA Business-Centric Approach to Design System Strategy
A Business-Centric Approach to Design System Strategy
 
Your enemies use GenAI too - staying ahead of fraud with Neo4j
Your enemies use GenAI too - staying ahead of fraud with Neo4jYour enemies use GenAI too - staying ahead of fraud with Neo4j
Your enemies use GenAI too - staying ahead of fraud with Neo4j
 
Extensible Python: Robustness through Addition - PyCon 2024
Extensible Python: Robustness through Addition - PyCon 2024Extensible Python: Robustness through Addition - PyCon 2024
Extensible Python: Robustness through Addition - PyCon 2024
 
Easier, Faster, and More Powerful – Alles Neu macht der Mai -Wir durchleuchte...
Easier, Faster, and More Powerful – Alles Neu macht der Mai -Wir durchleuchte...Easier, Faster, and More Powerful – Alles Neu macht der Mai -Wir durchleuchte...
Easier, Faster, and More Powerful – Alles Neu macht der Mai -Wir durchleuchte...
 
How we scaled to 80K users by doing nothing!.pdf
How we scaled to 80K users by doing nothing!.pdfHow we scaled to 80K users by doing nothing!.pdf
How we scaled to 80K users by doing nothing!.pdf
 
TEST BANK For, Information Technology Project Management 9th Edition Kathy Sc...
TEST BANK For, Information Technology Project Management 9th Edition Kathy Sc...TEST BANK For, Information Technology Project Management 9th Edition Kathy Sc...
TEST BANK For, Information Technology Project Management 9th Edition Kathy Sc...
 
Working together SRE & Platform Engineering
Working together SRE & Platform EngineeringWorking together SRE & Platform Engineering
Working together SRE & Platform Engineering
 
ECS 2024 Teams Premium - Pretty Secure
ECS 2024   Teams Premium - Pretty SecureECS 2024   Teams Premium - Pretty Secure
ECS 2024 Teams Premium - Pretty Secure
 
Long journey of Ruby Standard library at RubyKaigi 2024
Long journey of Ruby Standard library at RubyKaigi 2024Long journey of Ruby Standard library at RubyKaigi 2024
Long journey of Ruby Standard library at RubyKaigi 2024
 
Easier, Faster, and More Powerful – Notes Document Properties Reimagined
Easier, Faster, and More Powerful – Notes Document Properties ReimaginedEasier, Faster, and More Powerful – Notes Document Properties Reimagined
Easier, Faster, and More Powerful – Notes Document Properties Reimagined
 
Overview of Hyperledger Foundation
Overview of Hyperledger FoundationOverview of Hyperledger Foundation
Overview of Hyperledger Foundation
 
Breaking Down the Flutterwave Scandal What You Need to Know.pdf
Breaking Down the Flutterwave Scandal What You Need to Know.pdfBreaking Down the Flutterwave Scandal What You Need to Know.pdf
Breaking Down the Flutterwave Scandal What You Need to Know.pdf
 
AI mind or machine power point presentation
AI mind or machine power point presentationAI mind or machine power point presentation
AI mind or machine power point presentation
 
BT & Neo4j _ How Knowledge Graphs help BT deliver Digital Transformation.pptx
BT & Neo4j _ How Knowledge Graphs help BT deliver Digital Transformation.pptxBT & Neo4j _ How Knowledge Graphs help BT deliver Digital Transformation.pptx
BT & Neo4j _ How Knowledge Graphs help BT deliver Digital Transformation.pptx
 

What's New in PHP 5.5

  • 1. WHAT'S NEW IN PHP 5.5 ·Corey Ballou @cballou
  • 2. GENERATORS Support for generators has been added via the yield keyword range(0, 1000000)vs. user supplied function
  • 3. EXAMPLE USAGE OF YIELD KEYWORD function getLines($filepath) { $f = fopen($filepath, 'r'); try { while ($line = fgets($f)) { yield $line; } } finally { fclose($f); } } foreach (getLines("file.txt") as $n => $line) { echo $line; }
  • 4. THE "FINALLY" KEYWORD IS FINALLY HERE Execute code ALWAYS. try { throw new Exception('hello'); } catch (Exception $e) { echo $e->getMessage(); } finally { // this code will always be run echo ', world'; }
  • 5. PASSWORD HASHING API A super easy library that uses underlying crypt library. password_get_info() password_hash() password_needs_rehash() password_verify()
  • 6. EXAMPLE OF REGISTER/LOGIN function register($username, $password) { $hash = password_hash($password, PASSWORD_BCRYPT); // save hash to database } function login($username, $password) { $hash = getHashFromDbByUsername($username); if (password_verify($password, $hash)) { // perform login (store session var) return true; } return false; }
  • 7. INCREASING PASSWORD SECURITY You can optionally supply your own salt and algorithmic cost. function register($username, $password) { $options = array('salt' => 'someRandomSalt', 'cost' => 12); $hash = password_hash($password, PASSWORD_BCRYPT, $options); // save hash to database }
  • 8. EXAMPLE OF UPGRADING YOUR HASHING ALGORITHM function login($username, $password) { $hash = getHashFromDbByUsername($username); if (password_verify($password, $hash)) { // check if hash is in updated format if (password_needs_rehash($hash, PASSWORD_BCRYPT)) { // perform update $hash = password_hash($password, PASSWORD_BCRYPT); // save new hash to database } // perform login (store session var) return true; } return false; }
  • 9. FOREACH + LIST $array = [ [1, 2], [3, 4], ]; foreach ($array as list($a, $b)) { echo "A: $a; B: $bn"; }
  • 10. ARRAY_COLUMN()FUN $people = [ [ 'firstname' => 'John', 'lastname' => 'Doe' ], [ 'firstname' => 'Jane', 'lastname' => 'Doe' ], ]; // contains [ 0 => 'John', 1 => 'Jane' ] $firstnames = array_column($people, 'firstname');
  • 11. IMPROVEMENTS TO EMPTY() function always_false() { return false; } if (empty(always_false())) { echo "Hello, world."; }
  • 12. ARRAY AND STRING LITERAL DEREFERENCING // array dereferencing echo [1, 2, 3][0]; // string dereferencing echo 'PHP'[0];
  • 13. NOW LET'S REALLY GET CRAZY... function foo() { return array(1, 2, 3); } echo foo()[2]; // prints 3 $func = function() { return array('a', 'b', 'c'); }; echo $func()[0]; // prints a
  • 14. ZEND OPTIMISER+ OPCACHE EXTENSION Not a replacement for APC/memcache(d). No user cache! Available in PHP 5.4 via install. Source available: https://github.com/zend- dev/ZendOptimizerPlus $ php -v PHP 5.4.17RC1 (cli) (built: Jun 22 2013 19:27:26) Copyright (c) 1997-2013 The PHP Group Zend Engine v2.4.0, Copyright (c) 1998-2013 Zend Technologies with Zend OPcache v7.0.2, Copyright (c) 1999-2013, by Zend Technolo gies
  • 15. SO, UH, WHAT IS AN OPCODE CACHE? Component designed to speed up performance of PHP without altering the app. Overrides PHP's default compiler callback by checking if a compiled intermediate-code version of the code is available in-memory. It skips compilation when it can!
  • 16. WHAT TO DO ABOUT DEPRECATED APC MODULE? APC User Cache is in the works: APC minus the opcode cache! github.com/krakjoe/apcu
  • 17. BACKWARDS INCOMPATIBLE CHANGES Win XP/2003 support dropped self, parent and static are case insensitive pack()and unpack()made more compatible with perl http://www.php.net/manual/en/migration55.deprecated.php
  • 18. CREDITS php.net - What has changed in PHP 5.5.x wiki.php.net - Integrating Zend Optimizer+ into the PHP distribution schlueters.de - Features in PHP trunk: Array dereferencing slideshare.net - What's new in PHP 5.5 stackoverflow.com - How do you use bcrypt for hashing passwords in PHP?
  • 19. QUESTIONS? COMMENTS? Thanks for pretending to enjoy my banter!