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

Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobeapidays
 
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...apidays
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxRustici Software
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Zilliz
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024The Digital Insurer
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherRemote DBA Services
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native ApplicationsWSO2
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAndrey Devyatkin
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businesspanagenda
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDropbox
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesrafiqahmad00786416
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...apidays
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MIND CTI
 
A Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source MilvusA Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source MilvusZilliz
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...apidays
 

Dernier (20)

Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
A Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source MilvusA Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source Milvus
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 

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!