SlideShare ist ein Scribd-Unternehmen logo
1 von 24
Downloaden Sie, um offline zu lesen
What’s new in PHP 5.5
Tom Corrigan
@thetommygnr
Melbourne PHP Users Group
May 2013
Wednesday, 22 May 13
Overview
• What’s new
• What’s gone
• What’s deprecated
• Current status of PHP 5.5
Wednesday, 22 May 13
Generators
• Syntactical sugar to avoid iterator boilerplate
• Introduce a new keyword yield
• https://wiki.php.net/rfc/generators
Wednesday, 22 May 13
Before generators
function getLinesFromFile($fileName) {
if (!$fileHandle = fopen($fileName, 'r')) {
return;
}
 
$lines = [];
while (false !== $line = fgets($fileHandle)) {
$lines[] = $line;
}
 
fclose($fileHandle);
 
return $lines;
}
 
$lines = getLinesFromFile($fileName);
foreach ($lines as $line) {
// do something with $line
}
Wednesday, 22 May 13
Generator in action
function getLinesFromFile($fileName) {
if (!$fileHandle = fopen($fileName, 'r')) {
return;
}
 
while (false !== $line = fgets($fileHandle)) {
yield $line;
}
 
fclose($fileHandle);
}
 
$lines = getLinesFromFile($fileName);
foreach ($lines as $line) {
// do something with $line
}
Wednesday, 22 May 13
Generator free approach
function doShit($filename){
if (!$fileHandle = fopen($fileName, 'r')) {
return;
}
 
while (false !== $line = fgets($fileHandle)) {
// do something with $line
}
 
fclose($fileHandle);
}
Wednesday, 22 May 13
Generators - my opinion
• Few use cases
• Every example I found demonstrated the functionality rather than its
utility
• More readable alternatives
Wednesday, 22 May 13
Finally
• New addition to try...catch blocks
• Code within a finally block will always be executed. Always!
• Useful for closing DB connections, file handles etc
• https://wiki.php.net/rfc/finally
Wednesday, 22 May 13
The problem:
$db = mysqli_connect();
try {
call_some_function($db); //function may throw exceptions which we can ‘t
handle
} catch (Exception $e) {
mysqli_close($db);
throw $e;
}
mysql_close($db);
Wednesday, 22 May 13
Finally: a solution
$db = mysqli_connect();
try {
call_some_function($db);//function may throw exceptions which we can ‘t
handle
} finally {
mysqli_close($db);
}
Wednesday, 22 May 13
Finally block is always executed
try {
return 2;
} finally {
echo "this will be calledn";
}
//this will never be called
echo "you can not see me";
this will be called
//return int(2)
Wednesday, 22 May 13
Opcache
• Zend Optimizer+ has been open sourced and renamed Opcache
• Included by default in PHP 5.5+
• This is a big win, it’s the fastest opcode cache for PHP, between
5%-20% faster than APC
• https://wiki.php.net/rfc/optimizerplus
Wednesday, 22 May 13
What about APC?
• No current plans to support PHP > 5.4
• Does it matter?
• Was always behind new PHP releases by months
• Opcache is faster
• Opcaches ships with PHP 5.5+
Wednesday, 22 May 13
APCu
• APC without the bytecode cache (userland caching only)
• PHP API maintains BC with APC
• https://github.com/krakjoe/apcu
Wednesday, 22 May 13
DateTimeImmutable
• DateTime
$dt = new DateTime(‘2013-05-21’);
$dt2 = $dt->modify(‘+1 day’);
echo $dt->format(‘Y-m-d’); //2013-5-22
echo $dt2->format(‘Y-m-d’); //2013-5-22
• DateTimeImmutable
$dt = new DateTimeImmutable(‘2013-05-21’);
$dt2 = $dt->modify(‘+1 day’);
echo $dt->format(‘Y-m-d’); //2013-5-21
echo $dt2->format(‘Y-m-d’); //2013-5-22
• Warning: Extends DateTime, type hints won’t save you
Wednesday, 22 May 13
Constant array and string
dereferencing
You can now do this:
echo [“one”, “two”, “three”][1];
=> “two”
And this:
echo “onetwothree”[1];
=> “n”
Wednesday, 22 May 13
list() inside foreach
$talks = [
[
"speaker" => "Tom Corrigan",
"talk" => "What’s new in PHP 5.5",
],
[
"speaker" => "Rick Measham",
"talk" => "Hacker tips for getting hired",
],
];
foreach ($talks as list($speaker, $talk){
echo $speaker. " on " . $talk . PHP_EOL;
}
// Tom Corrigan on What’s new in PHP 5.5
// Rick Measham on Hacker tips for getting hired
•https://wiki.php.net/rfc/foreachlist
Wednesday, 22 May 13
array_column()
$talks = [
[
"speaker" => "Tom Corrigan",
"talk" => "What’s new in PHP 5.5",
],
[
"speaker" => "Rick Measham",
"talk" => "Hacker tips for getting hired",
],
];
$speakers = array_column($talks, "speaker");
//array
[0] Tom Corrigan
[1] Rick Measham
• https://wiki.php.net/rfc/array_column
Wednesday, 22 May 13
Password hash
• Colby did a talk last month
• Use it today in PHP 5.3.7+ https://github.com/ircmaxell/
password_compat
Wednesday, 22 May 13
Tons of new stuff in ext/intl
• Didn’t get time to cover this one, sorry!
• See: http://www.php.net/manual/en/migration55.classes.php
Wednesday, 22 May 13
Removed/changed
• No Windows XP or 2003 support
• Case insensitivity no longer locale specific
• Logo functions removed: php_logo_guid(), php_egg_logo_guid() etc
• Changes to pack() and unpack() BC BREAK
• http://www.php.net/manual/en/migration55.incompatible.php
Wednesday, 22 May 13
Deprecated
• ext/mysql !!!!
• preg_replace() /e modifier, use preg_replace_callback() (good!)
• IntlDateFormatter::setTimeZoneID() and datefmt_set_timezone_id()
• some mcrypt functions
• http://www.php.net/manual/en/migration55.deprecated.php
Wednesday, 22 May 13
Current status
• First Release Candidate: 9 May
• Second RC due out on 23rd May
• Expected stable release soon
Wednesday, 22 May 13
Questions?
Wednesday, 22 May 13

Weitere ähnliche Inhalte

Was ist angesagt?

Webrtc mojo
Webrtc mojoWebrtc mojo
Webrtc mojobpmedley
 
Php in 2013 (Web-5 2013 conference)
Php in 2013 (Web-5 2013 conference)Php in 2013 (Web-5 2013 conference)
Php in 2013 (Web-5 2013 conference)julien pauli
 
Yapcasia2011 - Hello Embed Perl
Yapcasia2011 - Hello Embed PerlYapcasia2011 - Hello Embed Perl
Yapcasia2011 - Hello Embed PerlHideaki Ohno
 
Melhorando sua API com DSLs
Melhorando sua API com DSLsMelhorando sua API com DSLs
Melhorando sua API com DSLsAugusto Pascutti
 
PHP 5.3 And PHP 6 A Look Ahead
PHP 5.3 And PHP 6 A Look AheadPHP 5.3 And PHP 6 A Look Ahead
PHP 5.3 And PHP 6 A Look Aheadthinkphp
 
Smolder @Silex
Smolder @SilexSmolder @Silex
Smolder @SilexJeen Lee
 
Kansai.pm 10周年記念 Plack/PSGI 入門
Kansai.pm 10周年記念 Plack/PSGI 入門Kansai.pm 10周年記念 Plack/PSGI 入門
Kansai.pm 10周年記念 Plack/PSGI 入門lestrrat
 
GettingStartedWithPHP
GettingStartedWithPHPGettingStartedWithPHP
GettingStartedWithPHPNat Weerawan
 
Cli the other SAPI confoo11
Cli the other SAPI confoo11Cli the other SAPI confoo11
Cli the other SAPI confoo11Combell NV
 
CLI, the other SAPI phpnw11
CLI, the other SAPI phpnw11CLI, the other SAPI phpnw11
CLI, the other SAPI phpnw11Combell NV
 
Zephir - A Wind of Change for writing PHP extensions
Zephir - A Wind of Change for writing PHP extensionsZephir - A Wind of Change for writing PHP extensions
Zephir - A Wind of Change for writing PHP extensionsMark Baker
 
関西PHP勉強会 php5.4つまみぐい
関西PHP勉強会 php5.4つまみぐい関西PHP勉強会 php5.4つまみぐい
関西PHP勉強会 php5.4つまみぐいHisateru Tanaka
 
AnyMQ, Hippie, and the real-time web
AnyMQ, Hippie, and the real-time webAnyMQ, Hippie, and the real-time web
AnyMQ, Hippie, and the real-time webclkao
 
Asynchronous I/O in PHP
Asynchronous I/O in PHPAsynchronous I/O in PHP
Asynchronous I/O in PHPThomas Weinert
 
Php 7 hhvm and co
Php 7 hhvm and coPhp 7 hhvm and co
Php 7 hhvm and coPierre Joye
 
Perl web frameworks
Perl web frameworksPerl web frameworks
Perl web frameworksdiego_k
 
ekb.py - Python VS ...
ekb.py - Python VS ...ekb.py - Python VS ...
ekb.py - Python VS ...it-people
 
ZeroMQ Is The Answer
ZeroMQ Is The AnswerZeroMQ Is The Answer
ZeroMQ Is The AnswerIan Barber
 

Was ist angesagt? (20)

PHP7 Presentation
PHP7 PresentationPHP7 Presentation
PHP7 Presentation
 
Webrtc mojo
Webrtc mojoWebrtc mojo
Webrtc mojo
 
Php in 2013 (Web-5 2013 conference)
Php in 2013 (Web-5 2013 conference)Php in 2013 (Web-5 2013 conference)
Php in 2013 (Web-5 2013 conference)
 
Yapcasia2011 - Hello Embed Perl
Yapcasia2011 - Hello Embed PerlYapcasia2011 - Hello Embed Perl
Yapcasia2011 - Hello Embed Perl
 
Melhorando sua API com DSLs
Melhorando sua API com DSLsMelhorando sua API com DSLs
Melhorando sua API com DSLs
 
Php hacku
Php hackuPhp hacku
Php hacku
 
PHP 5.3 And PHP 6 A Look Ahead
PHP 5.3 And PHP 6 A Look AheadPHP 5.3 And PHP 6 A Look Ahead
PHP 5.3 And PHP 6 A Look Ahead
 
Smolder @Silex
Smolder @SilexSmolder @Silex
Smolder @Silex
 
Kansai.pm 10周年記念 Plack/PSGI 入門
Kansai.pm 10周年記念 Plack/PSGI 入門Kansai.pm 10周年記念 Plack/PSGI 入門
Kansai.pm 10周年記念 Plack/PSGI 入門
 
GettingStartedWithPHP
GettingStartedWithPHPGettingStartedWithPHP
GettingStartedWithPHP
 
Cli the other SAPI confoo11
Cli the other SAPI confoo11Cli the other SAPI confoo11
Cli the other SAPI confoo11
 
CLI, the other SAPI phpnw11
CLI, the other SAPI phpnw11CLI, the other SAPI phpnw11
CLI, the other SAPI phpnw11
 
Zephir - A Wind of Change for writing PHP extensions
Zephir - A Wind of Change for writing PHP extensionsZephir - A Wind of Change for writing PHP extensions
Zephir - A Wind of Change for writing PHP extensions
 
関西PHP勉強会 php5.4つまみぐい
関西PHP勉強会 php5.4つまみぐい関西PHP勉強会 php5.4つまみぐい
関西PHP勉強会 php5.4つまみぐい
 
AnyMQ, Hippie, and the real-time web
AnyMQ, Hippie, and the real-time webAnyMQ, Hippie, and the real-time web
AnyMQ, Hippie, and the real-time web
 
Asynchronous I/O in PHP
Asynchronous I/O in PHPAsynchronous I/O in PHP
Asynchronous I/O in PHP
 
Php 7 hhvm and co
Php 7 hhvm and coPhp 7 hhvm and co
Php 7 hhvm and co
 
Perl web frameworks
Perl web frameworksPerl web frameworks
Perl web frameworks
 
ekb.py - Python VS ...
ekb.py - Python VS ...ekb.py - Python VS ...
ekb.py - Python VS ...
 
ZeroMQ Is The Answer
ZeroMQ Is The AnswerZeroMQ Is The Answer
ZeroMQ Is The Answer
 

Andere mochten auch

Question 1 for media evaluation pow
Question 1 for media evaluation powQuestion 1 for media evaluation pow
Question 1 for media evaluation powMaddie Bonneau
 
Whetstone u09a1.irregular verbs
Whetstone u09a1.irregular verbsWhetstone u09a1.irregular verbs
Whetstone u09a1.irregular verbsjillwhetstone
 
Rebeca salas y hilary jimenes
Rebeca salas y hilary jimenesRebeca salas y hilary jimenes
Rebeca salas y hilary jimenesRebeca Salas
 
ДНЗ № 189 ( круглый стол)
ДНЗ № 189 ( круглый стол)ДНЗ № 189 ( круглый стол)
ДНЗ № 189 ( круглый стол)olchik_p
 
Springley - Water Case Study
Springley - Water Case StudySpringley - Water Case Study
Springley - Water Case StudyFakhir Rehman
 
Презентация Васильківської ЗОШ І-ІІІ ст№8 "Військове містечко11""
Презентация Васильківської ЗОШ І-ІІІ ст№8 "Військове містечко11""Презентация Васильківської ЗОШ І-ІІІ ст№8 "Військове містечко11""
Презентация Васильківської ЗОШ І-ІІІ ст№8 "Військове містечко11""08600 Vasilkov
 
My Certificates - Volume 1
My Certificates - Volume 1My Certificates - Volume 1
My Certificates - Volume 1Tony Campanale
 
физкультурно оздоровительный блок
физкультурно оздоровительный блокфизкультурно оздоровительный блок
физкультурно оздоровительный блокAkuJIa
 
You can take it with you: Rollover planning
You can take it with you: Rollover planningYou can take it with you: Rollover planning
You can take it with you: Rollover planningJayme Lacour
 
Parallel Computing for Econometricians with Amazon Web Services
Parallel Computing for Econometricians with Amazon Web ServicesParallel Computing for Econometricians with Amazon Web Services
Parallel Computing for Econometricians with Amazon Web Servicesstephenjbarr
 
Report of the science society
Report of the science societyReport of the science society
Report of the science societyhanisah67
 
Презентація команди Васильківської ЗОШ І-ІІІ ступенів №2
Презентація команди Васильківської ЗОШ І-ІІІ ступенів №2Презентація команди Васильківської ЗОШ І-ІІІ ступенів №2
Презентація команди Васильківської ЗОШ І-ІІІ ступенів №208600 Vasilkov
 
Big data網站分析─google analytics學習筆記 (情報快訊與轉換功能)
Big data網站分析─google analytics學習筆記 (情報快訊與轉換功能) Big data網站分析─google analytics學習筆記 (情報快訊與轉換功能)
Big data網站分析─google analytics學習筆記 (情報快訊與轉換功能) Anna Su
 

Andere mochten auch (20)

Impl installation manual
Impl installation manualImpl installation manual
Impl installation manual
 
Master project vol i
Master project vol iMaster project vol i
Master project vol i
 
Question 1 for media evaluation pow
Question 1 for media evaluation powQuestion 1 for media evaluation pow
Question 1 for media evaluation pow
 
Whetstone u09a1.irregular verbs
Whetstone u09a1.irregular verbsWhetstone u09a1.irregular verbs
Whetstone u09a1.irregular verbs
 
Rebeca salas y hilary jimenes
Rebeca salas y hilary jimenesRebeca salas y hilary jimenes
Rebeca salas y hilary jimenes
 
ДНЗ № 189 ( круглый стол)
ДНЗ № 189 ( круглый стол)ДНЗ № 189 ( круглый стол)
ДНЗ № 189 ( круглый стол)
 
James e cook jr!
James e cook jr!James e cook jr!
James e cook jr!
 
Springley - Water Case Study
Springley - Water Case StudySpringley - Water Case Study
Springley - Water Case Study
 
Chapter07
Chapter07Chapter07
Chapter07
 
Презентация Васильківської ЗОШ І-ІІІ ст№8 "Військове містечко11""
Презентация Васильківської ЗОШ І-ІІІ ст№8 "Військове містечко11""Презентация Васильківської ЗОШ І-ІІІ ст№8 "Військове містечко11""
Презентация Васильківської ЗОШ І-ІІІ ст№8 "Військове містечко11""
 
My Certificates - Volume 1
My Certificates - Volume 1My Certificates - Volume 1
My Certificates - Volume 1
 
Word by word fatima and laura
Word by word fatima and lauraWord by word fatima and laura
Word by word fatima and laura
 
физкультурно оздоровительный блок
физкультурно оздоровительный блокфизкультурно оздоровительный блок
физкультурно оздоровительный блок
 
You can take it with you: Rollover planning
You can take it with you: Rollover planningYou can take it with you: Rollover planning
You can take it with you: Rollover planning
 
Parallel Computing for Econometricians with Amazon Web Services
Parallel Computing for Econometricians with Amazon Web ServicesParallel Computing for Econometricians with Amazon Web Services
Parallel Computing for Econometricians with Amazon Web Services
 
Celebramos os maios
Celebramos os maios Celebramos os maios
Celebramos os maios
 
Report of the science society
Report of the science societyReport of the science society
Report of the science society
 
Презентація команди Васильківської ЗОШ І-ІІІ ступенів №2
Презентація команди Васильківської ЗОШ І-ІІІ ступенів №2Презентація команди Васильківської ЗОШ І-ІІІ ступенів №2
Презентація команди Васильківської ЗОШ І-ІІІ ступенів №2
 
Task 1
Task 1Task 1
Task 1
 
Big data網站分析─google analytics學習筆記 (情報快訊與轉換功能)
Big data網站分析─google analytics學習筆記 (情報快訊與轉換功能) Big data網站分析─google analytics學習筆記 (情報快訊與轉換功能)
Big data網站分析─google analytics學習筆記 (情報快訊與轉換功能)
 

Ähnlich wie What's new in PHP 5.5

The why and how of moving to php 5.4
The why and how of moving to php 5.4The why and how of moving to php 5.4
The why and how of moving to php 5.4Wim Godden
 
The why and how of moving to PHP 5.4/5.5
The why and how of moving to PHP 5.4/5.5The why and how of moving to PHP 5.4/5.5
The why and how of moving to PHP 5.4/5.5Wim Godden
 
The why and how of moving to php 5.4/5.5
The why and how of moving to php 5.4/5.5The why and how of moving to php 5.4/5.5
The why and how of moving to php 5.4/5.5Wim Godden
 
PHP Streams
PHP StreamsPHP Streams
PHP StreamsG Woo
 
Debugging: Rules & Tools
Debugging: Rules & ToolsDebugging: Rules & Tools
Debugging: Rules & ToolsIan Barber
 
PHP 5.3 Overview
PHP 5.3 OverviewPHP 5.3 Overview
PHP 5.3 Overviewjsmith92
 
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
 
The new features of PHP 7 - Enrico Zimuel - Codemotion Milan 2016
The new features of PHP 7 - Enrico Zimuel - Codemotion Milan 2016The new features of PHP 7 - Enrico Zimuel - Codemotion Milan 2016
The new features of PHP 7 - Enrico Zimuel - Codemotion Milan 2016Codemotion
 
Php7 HHVM and co
Php7 HHVM and coPhp7 HHVM and co
Php7 HHVM and coweltling
 
2012 coscup - Build your PHP application on Heroku
2012 coscup - Build your PHP application on Heroku2012 coscup - Build your PHP application on Heroku
2012 coscup - Build your PHP application on Herokuronnywang_tw
 
Php basic for vit university
Php basic for vit universityPhp basic for vit university
Php basic for vit universityMandakini Kumari
 
The why and how of moving to PHP 5.5/5.6
The why and how of moving to PHP 5.5/5.6The why and how of moving to PHP 5.5/5.6
The why and how of moving to PHP 5.5/5.6Wim Godden
 
Php7 hhvm and co
Php7 hhvm and coPhp7 hhvm and co
Php7 hhvm and coPierre Joye
 
Time tested php with libtimemachine
Time tested php with libtimemachineTime tested php with libtimemachine
Time tested php with libtimemachineNick Galbreath
 

Ähnlich wie What's new in PHP 5.5 (20)

The why and how of moving to php 5.4
The why and how of moving to php 5.4The why and how of moving to php 5.4
The why and how of moving to php 5.4
 
The why and how of moving to PHP 5.4/5.5
The why and how of moving to PHP 5.4/5.5The why and how of moving to PHP 5.4/5.5
The why and how of moving to PHP 5.4/5.5
 
The why and how of moving to php 5.4/5.5
The why and how of moving to php 5.4/5.5The why and how of moving to php 5.4/5.5
The why and how of moving to php 5.4/5.5
 
PHP Streams
PHP StreamsPHP Streams
PHP Streams
 
ZendCon 08 php 5.3
ZendCon 08 php 5.3ZendCon 08 php 5.3
ZendCon 08 php 5.3
 
Debugging: Rules & Tools
Debugging: Rules & ToolsDebugging: Rules & Tools
Debugging: Rules & Tools
 
PHP 5.3 Overview
PHP 5.3 OverviewPHP 5.3 Overview
PHP 5.3 Overview
 
What's new with PHP7
What's new with PHP7What's new with PHP7
What's new 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
 
The new features of PHP 7 - Enrico Zimuel - Codemotion Milan 2016
The new features of PHP 7 - Enrico Zimuel - Codemotion Milan 2016The new features of PHP 7 - Enrico Zimuel - Codemotion Milan 2016
The new features of PHP 7 - Enrico Zimuel - Codemotion Milan 2016
 
Php7 HHVM and co
Php7 HHVM and coPhp7 HHVM and co
Php7 HHVM and co
 
2012 coscup - Build your PHP application on Heroku
2012 coscup - Build your PHP application on Heroku2012 coscup - Build your PHP application on Heroku
2012 coscup - Build your PHP application on Heroku
 
Php basic for vit university
Php basic for vit universityPhp basic for vit university
Php basic for vit university
 
Current state-of-php
Current state-of-phpCurrent state-of-php
Current state-of-php
 
PHP 5 Sucks. PHP 5 Rocks.
PHP 5 Sucks. PHP 5 Rocks.PHP 5 Sucks. PHP 5 Rocks.
PHP 5 Sucks. PHP 5 Rocks.
 
The why and how of moving to PHP 5.5/5.6
The why and how of moving to PHP 5.5/5.6The why and how of moving to PHP 5.5/5.6
The why and how of moving to PHP 5.5/5.6
 
New in php 7
New in php 7New in php 7
New in php 7
 
Php7 hhvm and co
Php7 hhvm and coPhp7 hhvm and co
Php7 hhvm and co
 
50 shades of PHP
50 shades of PHP50 shades of PHP
50 shades of PHP
 
Time tested php with libtimemachine
Time tested php with libtimemachineTime tested php with libtimemachine
Time tested php with libtimemachine
 

Kürzlich hochgeladen

UiPath Studio Web workshop series - Day 6
UiPath Studio Web workshop series - Day 6UiPath Studio Web workshop series - Day 6
UiPath Studio Web workshop series - Day 6DianaGray10
 
99.99% of Your Traces Are (Probably) Trash (SRECon NA 2024).pdf
99.99% of Your Traces  Are (Probably) Trash (SRECon NA 2024).pdf99.99% of Your Traces  Are (Probably) Trash (SRECon NA 2024).pdf
99.99% of Your Traces Are (Probably) Trash (SRECon NA 2024).pdfPaige Cruz
 
AI Fame Rush Review – Virtual Influencer Creation In Just Minutes
AI Fame Rush Review – Virtual Influencer Creation In Just MinutesAI Fame Rush Review – Virtual Influencer Creation In Just Minutes
AI Fame Rush Review – Virtual Influencer Creation In Just MinutesMd Hossain Ali
 
UiPath Solutions Management Preview - Northern CA Chapter - March 22.pdf
UiPath Solutions Management Preview - Northern CA Chapter - March 22.pdfUiPath Solutions Management Preview - Northern CA Chapter - March 22.pdf
UiPath Solutions Management Preview - Northern CA Chapter - March 22.pdfDianaGray10
 
UiPath Studio Web workshop series - Day 5
UiPath Studio Web workshop series - Day 5UiPath Studio Web workshop series - Day 5
UiPath Studio Web workshop series - Day 5DianaGray10
 
Valere | Digital Solutions & AI Transformation Portfolio | 2024
Valere | Digital Solutions & AI Transformation Portfolio | 2024Valere | Digital Solutions & AI Transformation Portfolio | 2024
Valere | Digital Solutions & AI Transformation Portfolio | 2024Alexander Turgeon
 
Anypoint Code Builder , Google Pub sub connector and MuleSoft RPA
Anypoint Code Builder , Google Pub sub connector and MuleSoft RPAAnypoint Code Builder , Google Pub sub connector and MuleSoft RPA
Anypoint Code Builder , Google Pub sub connector and MuleSoft RPAshyamraj55
 
OpenShift Commons Paris - Choose Your Own Observability Adventure
OpenShift Commons Paris - Choose Your Own Observability AdventureOpenShift Commons Paris - Choose Your Own Observability Adventure
OpenShift Commons Paris - Choose Your Own Observability AdventureEric D. Schabell
 
Secure your environment with UiPath and CyberArk technologies - Session 1
Secure your environment with UiPath and CyberArk technologies - Session 1Secure your environment with UiPath and CyberArk technologies - Session 1
Secure your environment with UiPath and CyberArk technologies - Session 1DianaGray10
 
IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019
IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019
IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019IES VE
 
20230202 - Introduction to tis-py
20230202 - Introduction to tis-py20230202 - Introduction to tis-py
20230202 - Introduction to tis-pyJamie (Taka) Wang
 
UiPath Studio Web workshop series - Day 7
UiPath Studio Web workshop series - Day 7UiPath Studio Web workshop series - Day 7
UiPath Studio Web workshop series - Day 7DianaGray10
 
Meet the new FSP 3000 M-Flex800™
Meet the new FSP 3000 M-Flex800™Meet the new FSP 3000 M-Flex800™
Meet the new FSP 3000 M-Flex800™Adtran
 
UiPath Clipboard AI: "A TIME Magazine Best Invention of 2023 Unveiled"
UiPath Clipboard AI: "A TIME Magazine Best Invention of 2023 Unveiled"UiPath Clipboard AI: "A TIME Magazine Best Invention of 2023 Unveiled"
UiPath Clipboard AI: "A TIME Magazine Best Invention of 2023 Unveiled"DianaGray10
 
100+ ChatGPT Prompts for SEO Optimization
100+ ChatGPT Prompts for SEO Optimization100+ ChatGPT Prompts for SEO Optimization
100+ ChatGPT Prompts for SEO Optimizationarrow10202532yuvraj
 
IEEE Computer Society’s Strategic Activities and Products including SWEBOK Guide
IEEE Computer Society’s Strategic Activities and Products including SWEBOK GuideIEEE Computer Society’s Strategic Activities and Products including SWEBOK Guide
IEEE Computer Society’s Strategic Activities and Products including SWEBOK GuideHironori Washizaki
 
The Kubernetes Gateway API and its role in Cloud Native API Management
The Kubernetes Gateway API and its role in Cloud Native API ManagementThe Kubernetes Gateway API and its role in Cloud Native API Management
The Kubernetes Gateway API and its role in Cloud Native API ManagementNuwan Dias
 
Building Your Own AI Instance (TBLC AI )
Building Your Own AI Instance (TBLC AI )Building Your Own AI Instance (TBLC AI )
Building Your Own AI Instance (TBLC AI )Brian Pichman
 
Governance in SharePoint Premium:What's in the box?
Governance in SharePoint Premium:What's in the box?Governance in SharePoint Premium:What's in the box?
Governance in SharePoint Premium:What's in the box?Juan Carlos Gonzalez
 

Kürzlich hochgeladen (20)

UiPath Studio Web workshop series - Day 6
UiPath Studio Web workshop series - Day 6UiPath Studio Web workshop series - Day 6
UiPath Studio Web workshop series - Day 6
 
99.99% of Your Traces Are (Probably) Trash (SRECon NA 2024).pdf
99.99% of Your Traces  Are (Probably) Trash (SRECon NA 2024).pdf99.99% of Your Traces  Are (Probably) Trash (SRECon NA 2024).pdf
99.99% of Your Traces Are (Probably) Trash (SRECon NA 2024).pdf
 
AI Fame Rush Review – Virtual Influencer Creation In Just Minutes
AI Fame Rush Review – Virtual Influencer Creation In Just MinutesAI Fame Rush Review – Virtual Influencer Creation In Just Minutes
AI Fame Rush Review – Virtual Influencer Creation In Just Minutes
 
UiPath Solutions Management Preview - Northern CA Chapter - March 22.pdf
UiPath Solutions Management Preview - Northern CA Chapter - March 22.pdfUiPath Solutions Management Preview - Northern CA Chapter - March 22.pdf
UiPath Solutions Management Preview - Northern CA Chapter - March 22.pdf
 
UiPath Studio Web workshop series - Day 5
UiPath Studio Web workshop series - Day 5UiPath Studio Web workshop series - Day 5
UiPath Studio Web workshop series - Day 5
 
Valere | Digital Solutions & AI Transformation Portfolio | 2024
Valere | Digital Solutions & AI Transformation Portfolio | 2024Valere | Digital Solutions & AI Transformation Portfolio | 2024
Valere | Digital Solutions & AI Transformation Portfolio | 2024
 
Anypoint Code Builder , Google Pub sub connector and MuleSoft RPA
Anypoint Code Builder , Google Pub sub connector and MuleSoft RPAAnypoint Code Builder , Google Pub sub connector and MuleSoft RPA
Anypoint Code Builder , Google Pub sub connector and MuleSoft RPA
 
OpenShift Commons Paris - Choose Your Own Observability Adventure
OpenShift Commons Paris - Choose Your Own Observability AdventureOpenShift Commons Paris - Choose Your Own Observability Adventure
OpenShift Commons Paris - Choose Your Own Observability Adventure
 
Secure your environment with UiPath and CyberArk technologies - Session 1
Secure your environment with UiPath and CyberArk technologies - Session 1Secure your environment with UiPath and CyberArk technologies - Session 1
Secure your environment with UiPath and CyberArk technologies - Session 1
 
IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019
IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019
IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019
 
20230202 - Introduction to tis-py
20230202 - Introduction to tis-py20230202 - Introduction to tis-py
20230202 - Introduction to tis-py
 
UiPath Studio Web workshop series - Day 7
UiPath Studio Web workshop series - Day 7UiPath Studio Web workshop series - Day 7
UiPath Studio Web workshop series - Day 7
 
Meet the new FSP 3000 M-Flex800™
Meet the new FSP 3000 M-Flex800™Meet the new FSP 3000 M-Flex800™
Meet the new FSP 3000 M-Flex800™
 
UiPath Clipboard AI: "A TIME Magazine Best Invention of 2023 Unveiled"
UiPath Clipboard AI: "A TIME Magazine Best Invention of 2023 Unveiled"UiPath Clipboard AI: "A TIME Magazine Best Invention of 2023 Unveiled"
UiPath Clipboard AI: "A TIME Magazine Best Invention of 2023 Unveiled"
 
20230104 - machine vision
20230104 - machine vision20230104 - machine vision
20230104 - machine vision
 
100+ ChatGPT Prompts for SEO Optimization
100+ ChatGPT Prompts for SEO Optimization100+ ChatGPT Prompts for SEO Optimization
100+ ChatGPT Prompts for SEO Optimization
 
IEEE Computer Society’s Strategic Activities and Products including SWEBOK Guide
IEEE Computer Society’s Strategic Activities and Products including SWEBOK GuideIEEE Computer Society’s Strategic Activities and Products including SWEBOK Guide
IEEE Computer Society’s Strategic Activities and Products including SWEBOK Guide
 
The Kubernetes Gateway API and its role in Cloud Native API Management
The Kubernetes Gateway API and its role in Cloud Native API ManagementThe Kubernetes Gateway API and its role in Cloud Native API Management
The Kubernetes Gateway API and its role in Cloud Native API Management
 
Building Your Own AI Instance (TBLC AI )
Building Your Own AI Instance (TBLC AI )Building Your Own AI Instance (TBLC AI )
Building Your Own AI Instance (TBLC AI )
 
Governance in SharePoint Premium:What's in the box?
Governance in SharePoint Premium:What's in the box?Governance in SharePoint Premium:What's in the box?
Governance in SharePoint Premium:What's in the box?
 

What's new in PHP 5.5

  • 1. What’s new in PHP 5.5 Tom Corrigan @thetommygnr Melbourne PHP Users Group May 2013 Wednesday, 22 May 13
  • 2. Overview • What’s new • What’s gone • What’s deprecated • Current status of PHP 5.5 Wednesday, 22 May 13
  • 3. Generators • Syntactical sugar to avoid iterator boilerplate • Introduce a new keyword yield • https://wiki.php.net/rfc/generators Wednesday, 22 May 13
  • 4. Before generators function getLinesFromFile($fileName) { if (!$fileHandle = fopen($fileName, 'r')) { return; }   $lines = []; while (false !== $line = fgets($fileHandle)) { $lines[] = $line; }   fclose($fileHandle);   return $lines; }   $lines = getLinesFromFile($fileName); foreach ($lines as $line) { // do something with $line } Wednesday, 22 May 13
  • 5. Generator in action function getLinesFromFile($fileName) { if (!$fileHandle = fopen($fileName, 'r')) { return; }   while (false !== $line = fgets($fileHandle)) { yield $line; }   fclose($fileHandle); }   $lines = getLinesFromFile($fileName); foreach ($lines as $line) { // do something with $line } Wednesday, 22 May 13
  • 6. Generator free approach function doShit($filename){ if (!$fileHandle = fopen($fileName, 'r')) { return; }   while (false !== $line = fgets($fileHandle)) { // do something with $line }   fclose($fileHandle); } Wednesday, 22 May 13
  • 7. Generators - my opinion • Few use cases • Every example I found demonstrated the functionality rather than its utility • More readable alternatives Wednesday, 22 May 13
  • 8. Finally • New addition to try...catch blocks • Code within a finally block will always be executed. Always! • Useful for closing DB connections, file handles etc • https://wiki.php.net/rfc/finally Wednesday, 22 May 13
  • 9. The problem: $db = mysqli_connect(); try { call_some_function($db); //function may throw exceptions which we can ‘t handle } catch (Exception $e) { mysqli_close($db); throw $e; } mysql_close($db); Wednesday, 22 May 13
  • 10. Finally: a solution $db = mysqli_connect(); try { call_some_function($db);//function may throw exceptions which we can ‘t handle } finally { mysqli_close($db); } Wednesday, 22 May 13
  • 11. Finally block is always executed try { return 2; } finally { echo "this will be calledn"; } //this will never be called echo "you can not see me"; this will be called //return int(2) Wednesday, 22 May 13
  • 12. Opcache • Zend Optimizer+ has been open sourced and renamed Opcache • Included by default in PHP 5.5+ • This is a big win, it’s the fastest opcode cache for PHP, between 5%-20% faster than APC • https://wiki.php.net/rfc/optimizerplus Wednesday, 22 May 13
  • 13. What about APC? • No current plans to support PHP > 5.4 • Does it matter? • Was always behind new PHP releases by months • Opcache is faster • Opcaches ships with PHP 5.5+ Wednesday, 22 May 13
  • 14. APCu • APC without the bytecode cache (userland caching only) • PHP API maintains BC with APC • https://github.com/krakjoe/apcu Wednesday, 22 May 13
  • 15. DateTimeImmutable • DateTime $dt = new DateTime(‘2013-05-21’); $dt2 = $dt->modify(‘+1 day’); echo $dt->format(‘Y-m-d’); //2013-5-22 echo $dt2->format(‘Y-m-d’); //2013-5-22 • DateTimeImmutable $dt = new DateTimeImmutable(‘2013-05-21’); $dt2 = $dt->modify(‘+1 day’); echo $dt->format(‘Y-m-d’); //2013-5-21 echo $dt2->format(‘Y-m-d’); //2013-5-22 • Warning: Extends DateTime, type hints won’t save you Wednesday, 22 May 13
  • 16. Constant array and string dereferencing You can now do this: echo [“one”, “two”, “three”][1]; => “two” And this: echo “onetwothree”[1]; => “n” Wednesday, 22 May 13
  • 17. list() inside foreach $talks = [ [ "speaker" => "Tom Corrigan", "talk" => "What’s new in PHP 5.5", ], [ "speaker" => "Rick Measham", "talk" => "Hacker tips for getting hired", ], ]; foreach ($talks as list($speaker, $talk){ echo $speaker. " on " . $talk . PHP_EOL; } // Tom Corrigan on What’s new in PHP 5.5 // Rick Measham on Hacker tips for getting hired •https://wiki.php.net/rfc/foreachlist Wednesday, 22 May 13
  • 18. array_column() $talks = [ [ "speaker" => "Tom Corrigan", "talk" => "What’s new in PHP 5.5", ], [ "speaker" => "Rick Measham", "talk" => "Hacker tips for getting hired", ], ]; $speakers = array_column($talks, "speaker"); //array [0] Tom Corrigan [1] Rick Measham • https://wiki.php.net/rfc/array_column Wednesday, 22 May 13
  • 19. Password hash • Colby did a talk last month • Use it today in PHP 5.3.7+ https://github.com/ircmaxell/ password_compat Wednesday, 22 May 13
  • 20. Tons of new stuff in ext/intl • Didn’t get time to cover this one, sorry! • See: http://www.php.net/manual/en/migration55.classes.php Wednesday, 22 May 13
  • 21. Removed/changed • No Windows XP or 2003 support • Case insensitivity no longer locale specific • Logo functions removed: php_logo_guid(), php_egg_logo_guid() etc • Changes to pack() and unpack() BC BREAK • http://www.php.net/manual/en/migration55.incompatible.php Wednesday, 22 May 13
  • 22. Deprecated • ext/mysql !!!! • preg_replace() /e modifier, use preg_replace_callback() (good!) • IntlDateFormatter::setTimeZoneID() and datefmt_set_timezone_id() • some mcrypt functions • http://www.php.net/manual/en/migration55.deprecated.php Wednesday, 22 May 13
  • 23. Current status • First Release Candidate: 9 May • Second RC due out on 23rd May • Expected stable release soon Wednesday, 22 May 13