SlideShare una empresa de Scribd logo
1 de 38
PHP in 2013
PHP's story to nowadays
Hello
● Hello, I'm Julien PAULI
– PHP 5.5 Release Manager
– Working for blablacar in Paris (www.blablacar.com)
– Working with PHP since ~10y
– Working on PHP internals ~3y
PHP Evolution
PHP's history
● 1995
1995 : CGI
data = getenv("QUERY_STRING");
if(data && *data) {
params = data; dest = data;
while(*data) {
if(*data=='+') *dest=' ';
else if(*data == '%' && ishex(*(data+1))&&ishex(*(data+2))) {
*dest = (char) htoi(data + 1);
data+=2;
} else *dest = *data;
data++; dest++;
}
*dest = '0'; s = strtok(params,"&");
do {
tmp = strchr(s,'=');
if(tmp) {
*tmp = '0';
if(!strcmp(s,"name")) name = tmp+1;
else if(!strcmp(s,"age")) age = tmp+1;
}
} while(s=strtok(NULL,"&"));
printf("Hi %s, you are %s years oldn",name,age);
}
Complex stuff
Better stuff
<html><head><title>Form Example</title></head>
<body><h1>My Example Form</h1>
<form action="form.phtml" method="POST">
Name: <input type="text" name="name">
Age: <input type="text" name="age">
<br><input type="submit">
</form>
<?if($name):?>
Hi <?echo $name?>, you are <?echo $age?> years old
<?endif?>
</body></html>
First PHPs
● PHP 1 then 2 and PHP 3
● 1998
● Who still remembers PHP 3 ?
Refresh your mind !
● Go and get it !
● http://museum.php.net
PHP 4
● 2000
● sessions
● Better extensions management
● Zend Engine
– Compilation
Zend Engine
● Zeev Suraski
● Andi Gutmans
● Total rewrite of PHP3
● Introduction of a compilation/execution engine
● Performances
PHP 5
● Zend Engine 2 (improved from 1, yep)
– New OO model (true model)
● 5.0 (2004)
● 5.1 (2005)
● 5.2 (2006)
● 5.3 (2009)
● 5.4 (2011)
● 5.5 (2013)
PHP release process
● Starting from 5.4, we have a release process
● https://wiki.php.net/rfc/releaseprocess
● Yearly new major/minor (5.4->5.5 or 6.0)
– New features
– Big changes. Majors may break BC
– 3 years of life (2 + 1)
● Monthly new revisions (5.4.3->5.4.4)
– Bug fixes, no new features, BC kept
● EOLed security releases
– After EOL, 1 year of security fixes
PHP Ecosystem
● Read/improve the doc
– www.php.net
– edit.php.net
● Develop
– wiki.php.net
– bugs.php.net
– git.php.net / pecl.php.net
– lxr.php.net
● Improve quality
– qa.php.net
– bugs.php.net
● Download
– snaps.php.net
– museum.php.net
Source distributions
● We use Git
– http://git.php.net
● We mirror on Github
– Social coding
– New ideas
– Pull Requests
PHP contributors
● About 10 to 15 active people
● Lots more total
● Contribute on
– Code (new features, changes, bugs&fixes)
– Doc & translations
– Infra services (hosting php.net worldwide)
– Human management
– … lots of things to do
PHP 5.5
PHP 5.5 new features
● Password hashing API
● "Finally" keyword
● Generators
● Syntax and engine improvements
● Breaks, deprecations
● … more not reported here
New Password hashing API
● PHP users don't really understand/care
about the concept behing hashing, salting
and crypting
● PHP doesn't give any hints about that
● User are left on their own
– Until 5.5 version
– Welcome a new password hashing API !
New Password hashing API
● https://wiki.php.net/rfc/password_hash
● See how easy that looks now :
– To generate a hash
$password = 'secret';
$hash = password_hash($password, PASSWORD_DEFAULT);
var_dump($hash);
// "$2y$10$Pa2cIqH5X3m6iqIYVDBdvOUcggnXnZzBy0dlie
4VRHLr3ncLcyB7a"
New Password hashing API
● https://wiki.php.net/rfc/password_hash
● See how easy that looks now :
– To verify a hash
$provided_password = 'secret';
$hash = "$2y$10$Pa2cIqH5X3m6iqIYVDBdvOUcggnXnZzBy0
dlie4VRHLr3ncLcyB7a";
if (password_verify($provided_password, $hash)) {
echo "you are welcome" ;
}
New Password hashing API
● More options :
– choose your hashing algorithm
– choose a salt from yours
– choose a CPU cost
$password = "mysecret" ;
$hash =password_hash($password, PASSWORD_BCRYPT,
array("cost" => 5, "salt" => "my_secret_salt") ) ;
New Password hashing API
● Just one Database field is needed
● The hash encapsulates all the infos
– algorithm used
– salt used
– cost used
– hash itself
"$2y$10$Pa2cIqH5X3m6iqIYVDBdvOUcggnXnZzBy0dlie4VR...
Other changes
● ext/intl has been massively worked on / improved
● ext/curl up to date with new libcurl
● bison < 2.4 no longer supported (parser)
● libpcre updated
● array_column()
● cli_set_process_title()
● Lots of bug fixes
Engine changes
foreach() changes
● Foreach now supports list()
● https://wiki.php.net/rfc/foreachlist
$users = array(
array('Foo', 'Bar'),
array('Baz', 'Qux');
);
// Before
foreach ($users as $user) {
list($firstName, $lastName) = $user;
echo "First name: $firstName, last name: $lastName. ";
}
// After
foreach ($users as list($firstName, $lastName)) {
echo "First name: $firstName, last name: $lastName. ";
}
Array dereferencing strings
● Dereference const expressions
● https://wiki.php.net/rfc/constdereference
var_dump( "php"[1] ); // 'h'
var_dump( [1, 2, 3][1] ); // 2
var_dump( [ ['foo, 'bar'], [1, 2] ] [0][1] ); // "bar"
OPCache
● OPCache = "ZendOptimizerPlus" for PHP
– It's been freed by Zend recently
– It's then been renamed
● OPCache will be shipped with PHP 5.5 , as
an extension you have to activate at compile
time
– it will be maintained together with PHP itself
● APC is now dead
OPCache roles
● OPCode caching + optimizing
Breaks
PHP 5.5 compatibility breaks
● ext/mysql has been deprecated /!
● /e modifier for preg() has been deprecated
● Dropped support for Windows XP and 2k3
● No more php logo and zend logo functions
● pack()/unpack() minor changes
Performances ?
● The biggest step was 5.3 to 5.4
– First time for such a boost
● 5.5 is faster than 5.4
– But don't expect the same effect than 5.3 to 5.4
Performances
● Testing blablacar.com
– PHPUnit 3.7.21
– 959 tests
– (Lots of external services and SQL)
Time: 14:32, Memory: 1202.50Mb
Time: 12:48, Memory: 995.50Mb
Time: 12:30, Memory: 996.50Mb
5.3.latest
5.4.latest
5.5.latest
Engine performance
● PHP 5.3.latest
empty_loop 0.161
func() 0.459 0.298
undef_func() 0.469 0.309
int_func() 0.446 0.285
$x = self::$x 0.444 0.284
self::$x = 0 0.441 0.281
isset(self::$x) 0.431 0.270
empty(self::$x) 0.443 0.283
$x = Foo::$x 0.586 0.425
Foo::$x = 0 0.808 0.647
isset(Foo::$x) 0.578 0.417
empty(Foo::$x) 0.590 0.429
self::f() 0.716 0.555
Foo::f() 0.752 0.591
$x = $this->x 0.426 0.265
$this->x = 0 0.497 0.337
$this->x += 2 0.439 0.279
++$this->x 0.381 0.220
--$this->x 0.404 0.244
$this->x++ 0.411 0.251
$this->x-- 0.415 0.254
isset($this->x) 0.423 0.263
empty($this->x) 0.433 0.272
$this->f() 0.610 0.449
$x = Foo::TEST 0.353 0.193
new Foo() 1.763 1.602
$x = TEST 0.371 0.211
$x = $_GET 0.361 0.200
$x = $GLOBALS['v'] 0.501 0.341
$x = $hash['v'] 0.355 0.194
$x = $str[0] 0.660 0.499
$x = $a ?: null 2.139 1.978
$x = $f ?: tmp 0.435 0.274
$x = $f ? $f : $a 2.141 1.980
$x = $f ? $f : tmp 0.418 0.258
Total 21.259
Engine performance
● PHP 5.4.latest
empty_loop 0.117
func() 0.380 0.263
undef_func() 0.377 0.260
int_func() 0.336 0.219
$x = self::$x 0.361 0.245
self::$x = 0 0.331 0.214
isset(self::$x) 0.232 0.116
empty(self::$x) 0.243 0.127
$x = Foo::$x 0.327 0.210
Foo::$x = 0 0.217 0.100
isset(Foo::$x) 0.279 0.162
empty(Foo::$x) 0.216 0.100
self::f() 0.398 0.281
Foo::f() 0.365 0.248
$x = $this->x 0.363 0.246
$this->x = 0 0.322 0.205
$this->x += 2 0.252 0.136
++$this->x 0.220 0.103
--$this->x 0.224 0.107
$this->x++ 0.248 0.132
$this->x-- 0.252 0.135
isset($this->x) 0.232 0.115
empty($this->x) 0.251 0.135
$this->f() 0.423 0.307
$x = Foo::TEST 0.220 0.103
new Foo() 0.821 0.705
$x = TEST 0.169 0.052
$x = $_GET 0.256 0.140
$x = $GLOBALS['v'] 0.450 0.334
$x = $hash['v'] 0.355 0.238
$x = $str[0] 0.369 0.252
$x = $a ?: null 0.235 0.118
$x = $f ?: tmp 0.330 0.213
$x = $f ? $f : $a 0.245 0.129
$x = $f ? $f : tmp 0.334 0.217
Total 10.749
Engine performance
● PHP 5.5.latest
empty_loop 0.117
func() 0.396 0.279
undef_func() 0.415 0.298
int_func() 0.325 0.208
$x = self::$x 0.286 0.169
self::$x = 0 0.399 0.282
isset(self::$x) 0.237 0.120
empty(self::$x) 0.282 0.165
$x = Foo::$x 0.246 0.129
Foo::$x = 0 0.320 0.203
isset(Foo::$x) 0.203 0.086
empty(Foo::$x) 0.248 0.131
self::f() 0.433 0.316
Foo::f() 0.395 0.278
$x = $this->x 0.249 0.132
$this->x = 0 0.320 0.203
$this->x += 2 0.251 0.134
++$this->x 0.309 0.192
--$this->x 0.223 0.106
$this->x++ 0.248 0.131
$this->x-- 0.258 0.141
isset($this->x) 0.236 0.119
empty($this->x) 0.262 0.145
$this->f() 0.438 0.321
$x = Foo::TEST 0.225 0.107
new Foo() 0.825 0.708
$x = TEST 0.177 0.060
$x = $_GET 0.262 0.145
$x = $GLOBALS['v'] 0.357 0.240
$x = $hash['v'] 0.267 0.150
$x = $str[0] 0.368 0.251
$x = $a ?: null 0.233 0.115
$x = $f ?: tmp 0.317 0.200
$x = $f ? $f : $a 0.254 0.137
$x = $f ? $f : tmp 0.318 0.201
Total 10.700
Thank you for listening !

Más contenido relacionado

La actualidad más candente

Php extensions workshop
Php extensions workshopPhp extensions workshop
Php extensions workshop
julien pauli
 
The Php Life Cycle
The Php Life CycleThe Php Life Cycle
The Php Life Cycle
Xinchen Hui
 
PHP Tips for certification - OdW13
PHP Tips for certification - OdW13PHP Tips for certification - OdW13
PHP Tips for certification - OdW13
julien pauli
 
Understanding PHP memory
Understanding PHP memoryUnderstanding PHP memory
Understanding PHP memory
julien pauli
 
How to deploy node to production
How to deploy node to productionHow to deploy node to production
How to deploy node to production
Sean Hess
 

La actualidad más candente (20)

Php extensions workshop
Php extensions workshopPhp extensions workshop
Php extensions workshop
 
PHP 7 new engine
PHP 7 new enginePHP 7 new engine
PHP 7 new engine
 
The Php Life Cycle
The Php Life CycleThe Php Life Cycle
The Php Life Cycle
 
Php and threads ZTS
Php and threads ZTSPhp and threads ZTS
Php and threads ZTS
 
PHP Tips for certification - OdW13
PHP Tips for certification - OdW13PHP Tips for certification - OdW13
PHP Tips for certification - OdW13
 
SymfonyCon 2017 php7 performances
SymfonyCon 2017 php7 performancesSymfonyCon 2017 php7 performances
SymfonyCon 2017 php7 performances
 
Symfony live 2017_php7_performances
Symfony live 2017_php7_performancesSymfony live 2017_php7_performances
Symfony live 2017_php7_performances
 
Understanding PHP memory
Understanding PHP memoryUnderstanding PHP memory
Understanding PHP memory
 
Building Custom PHP Extensions
Building Custom PHP ExtensionsBuilding Custom PHP Extensions
Building Custom PHP Extensions
 
Key features PHP 5.3 - 5.6
Key features PHP 5.3 - 5.6Key features PHP 5.3 - 5.6
Key features PHP 5.3 - 5.6
 
How PHP Works ?
How PHP Works ?How PHP Works ?
How PHP Works ?
 
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
 
PHP 7 OPCache extension review
PHP 7 OPCache extension reviewPHP 7 OPCache extension review
PHP 7 OPCache extension review
 
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 7 hhvm and co
Php 7 hhvm and coPhp 7 hhvm and co
Php 7 hhvm and co
 
PHP7 - Scalar Type Hints & Return Types
PHP7 - Scalar Type Hints & Return TypesPHP7 - Scalar Type Hints & Return Types
PHP7 - Scalar Type Hints & Return Types
 
Caching and tuning fun for high scalability @ FrOSCon 2011
Caching and tuning fun for high scalability @ FrOSCon 2011Caching and tuning fun for high scalability @ FrOSCon 2011
Caching and tuning fun for high scalability @ FrOSCon 2011
 
How to deploy node to production
How to deploy node to productionHow to deploy node to production
How to deploy node to production
 
Working with databases in Perl
Working with databases in PerlWorking with databases in Perl
Working with databases in Perl
 
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
 

Similar a Php in 2013 (Web-5 2013 conference)

GoLang & GoatCore
GoLang & GoatCore GoLang & GoatCore
GoLang & GoatCore
Sebastian Pożoga
 
Powershell Training
Powershell TrainingPowershell Training
Powershell Training
Fahad Noaman
 
Anatomy of a PHP Request ( UTOSC 2010 )
Anatomy of a PHP Request ( UTOSC 2010 )Anatomy of a PHP Request ( UTOSC 2010 )
Anatomy of a PHP Request ( UTOSC 2010 )
Joseph Scott
 

Similar a Php in 2013 (Web-5 2013 conference) (20)

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 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 5.6 From the Inside Out
Php 5.6 From the Inside OutPhp 5.6 From the Inside Out
Php 5.6 From the Inside Out
 
Debugging: Rules & Tools
Debugging: Rules & ToolsDebugging: Rules & Tools
Debugging: Rules & Tools
 
PHP 7 – What changed internally? (Forum PHP 2015)
PHP 7 – What changed internally? (Forum PHP 2015)PHP 7 – What changed internally? (Forum PHP 2015)
PHP 7 – What changed internally? (Forum PHP 2015)
 
Generated Power: PHP 5.5 Generators
Generated Power: PHP 5.5 GeneratorsGenerated Power: PHP 5.5 Generators
Generated Power: PHP 5.5 Generators
 
PHP 7 – What changed internally? (PHP Barcelona 2015)
PHP 7 – What changed internally? (PHP Barcelona 2015)PHP 7 – What changed internally? (PHP Barcelona 2015)
PHP 7 – What changed internally? (PHP Barcelona 2015)
 
"Swoole: double troubles in c", Alexandr Vronskiy
"Swoole: double troubles in c", Alexandr Vronskiy"Swoole: double troubles in c", Alexandr Vronskiy
"Swoole: double troubles in c", Alexandr Vronskiy
 
GoLang & GoatCore
GoLang & GoatCore GoLang & GoatCore
GoLang & GoatCore
 
Python于Web 2.0网站的应用 - QCon Beijing 2010
Python于Web 2.0网站的应用 - QCon Beijing 2010Python于Web 2.0网站的应用 - QCon Beijing 2010
Python于Web 2.0网站的应用 - QCon Beijing 2010
 
Internationalizing CakePHP Applications
Internationalizing CakePHP ApplicationsInternationalizing CakePHP Applications
Internationalizing CakePHP Applications
 
More Data, More Problems: Evolving big data machine learning pipelines with S...
More Data, More Problems: Evolving big data machine learning pipelines with S...More Data, More Problems: Evolving big data machine learning pipelines with S...
More Data, More Problems: Evolving big data machine learning pipelines with S...
 
Pdxpugday2010 pg90
Pdxpugday2010 pg90Pdxpugday2010 pg90
Pdxpugday2010 pg90
 
PHP 5.4
PHP 5.4PHP 5.4
PHP 5.4
 
Compare mysql5.1.50 mysql5.5.8
Compare mysql5.1.50 mysql5.5.8Compare mysql5.1.50 mysql5.5.8
Compare mysql5.1.50 mysql5.5.8
 
Powershell Training
Powershell TrainingPowershell Training
Powershell Training
 
Anatomy of a PHP Request ( UTOSC 2010 )
Anatomy of a PHP Request ( UTOSC 2010 )Anatomy of a PHP Request ( UTOSC 2010 )
Anatomy of a PHP Request ( UTOSC 2010 )
 
PHP in 2018 - Q4 - AFUP Limoges
PHP in 2018 - Q4 - AFUP LimogesPHP in 2018 - Q4 - AFUP Limoges
PHP in 2018 - Q4 - AFUP Limoges
 
Go Web Development
Go Web DevelopmentGo Web Development
Go Web Development
 
Ansible - Swiss Army Knife Orchestration
Ansible - Swiss Army Knife OrchestrationAnsible - Swiss Army Knife Orchestration
Ansible - Swiss Army Knife Orchestration
 

Más de julien pauli

Communications Réseaux et HTTP avec PHP
Communications Réseaux et HTTP avec PHPCommunications Réseaux et HTTP avec PHP
Communications Réseaux et HTTP avec PHP
julien pauli
 
PHPTour-2011-PHP_Extensions
PHPTour-2011-PHP_ExtensionsPHPTour-2011-PHP_Extensions
PHPTour-2011-PHP_Extensions
julien pauli
 
PHPTour 2011 - PHP5.4
PHPTour 2011 - PHP5.4PHPTour 2011 - PHP5.4
PHPTour 2011 - PHP5.4
julien pauli
 
Patterns and OOP in PHP
Patterns and OOP in PHPPatterns and OOP in PHP
Patterns and OOP in PHP
julien pauli
 

Más de julien pauli (14)

Doctrine with Symfony - SymfonyCon 2019
Doctrine with Symfony - SymfonyCon 2019Doctrine with Symfony - SymfonyCon 2019
Doctrine with Symfony - SymfonyCon 2019
 
Php engine
Php enginePhp engine
Php engine
 
Dns
DnsDns
Dns
 
PHP Internals and Virtual Machine
PHP Internals and Virtual MachinePHP Internals and Virtual Machine
PHP Internals and Virtual Machine
 
Basics of Cryptography - Stream ciphers and PRNG
Basics of Cryptography - Stream ciphers and PRNGBasics of Cryptography - Stream ciphers and PRNG
Basics of Cryptography - Stream ciphers and PRNG
 
Mastering your home network - Do It Yourself
Mastering your home network - Do It YourselfMastering your home network - Do It Yourself
Mastering your home network - Do It Yourself
 
Tcpip
TcpipTcpip
Tcpip
 
Communications Réseaux et HTTP avec PHP
Communications Réseaux et HTTP avec PHPCommunications Réseaux et HTTP avec PHP
Communications Réseaux et HTTP avec PHP
 
PHPTour-2011-PHP_Extensions
PHPTour-2011-PHP_ExtensionsPHPTour-2011-PHP_Extensions
PHPTour-2011-PHP_Extensions
 
PHPTour 2011 - PHP5.4
PHPTour 2011 - PHP5.4PHPTour 2011 - PHP5.4
PHPTour 2011 - PHP5.4
 
Patterns and OOP in PHP
Patterns and OOP in PHPPatterns and OOP in PHP
Patterns and OOP in PHP
 
ZendFramework2 - Présentation
ZendFramework2 - PrésentationZendFramework2 - Présentation
ZendFramework2 - Présentation
 
AlterWay SolutionsLinux Outils Industrialisation PHP
AlterWay SolutionsLinux Outils Industrialisation PHPAlterWay SolutionsLinux Outils Industrialisation PHP
AlterWay SolutionsLinux Outils Industrialisation PHP
 
Apache for développeurs PHP
Apache for développeurs PHPApache for développeurs PHP
Apache for développeurs PHP
 

Último

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
panagenda
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 

Último (20)

TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
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
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
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
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
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
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
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
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024
 
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...
 
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...
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 

Php in 2013 (Web-5 2013 conference)

  • 1. PHP in 2013 PHP's story to nowadays
  • 2. Hello ● Hello, I'm Julien PAULI – PHP 5.5 Release Manager – Working for blablacar in Paris (www.blablacar.com) – Working with PHP since ~10y – Working on PHP internals ~3y
  • 5. 1995 : CGI data = getenv("QUERY_STRING"); if(data && *data) { params = data; dest = data; while(*data) { if(*data=='+') *dest=' '; else if(*data == '%' && ishex(*(data+1))&&ishex(*(data+2))) { *dest = (char) htoi(data + 1); data+=2; } else *dest = *data; data++; dest++; } *dest = '0'; s = strtok(params,"&"); do { tmp = strchr(s,'='); if(tmp) { *tmp = '0'; if(!strcmp(s,"name")) name = tmp+1; else if(!strcmp(s,"age")) age = tmp+1; } } while(s=strtok(NULL,"&")); printf("Hi %s, you are %s years oldn",name,age); }
  • 7. Better stuff <html><head><title>Form Example</title></head> <body><h1>My Example Form</h1> <form action="form.phtml" method="POST"> Name: <input type="text" name="name"> Age: <input type="text" name="age"> <br><input type="submit"> </form> <?if($name):?> Hi <?echo $name?>, you are <?echo $age?> years old <?endif?> </body></html>
  • 8.
  • 9. First PHPs ● PHP 1 then 2 and PHP 3 ● 1998 ● Who still remembers PHP 3 ?
  • 10. Refresh your mind ! ● Go and get it ! ● http://museum.php.net
  • 11. PHP 4 ● 2000 ● sessions ● Better extensions management ● Zend Engine – Compilation
  • 12. Zend Engine ● Zeev Suraski ● Andi Gutmans ● Total rewrite of PHP3 ● Introduction of a compilation/execution engine ● Performances
  • 13. PHP 5 ● Zend Engine 2 (improved from 1, yep) – New OO model (true model) ● 5.0 (2004) ● 5.1 (2005) ● 5.2 (2006) ● 5.3 (2009) ● 5.4 (2011) ● 5.5 (2013)
  • 14. PHP release process ● Starting from 5.4, we have a release process ● https://wiki.php.net/rfc/releaseprocess ● Yearly new major/minor (5.4->5.5 or 6.0) – New features – Big changes. Majors may break BC – 3 years of life (2 + 1) ● Monthly new revisions (5.4.3->5.4.4) – Bug fixes, no new features, BC kept ● EOLed security releases – After EOL, 1 year of security fixes
  • 15. PHP Ecosystem ● Read/improve the doc – www.php.net – edit.php.net ● Develop – wiki.php.net – bugs.php.net – git.php.net / pecl.php.net – lxr.php.net ● Improve quality – qa.php.net – bugs.php.net ● Download – snaps.php.net – museum.php.net
  • 16. Source distributions ● We use Git – http://git.php.net ● We mirror on Github – Social coding – New ideas – Pull Requests
  • 17. PHP contributors ● About 10 to 15 active people ● Lots more total ● Contribute on – Code (new features, changes, bugs&fixes) – Doc & translations – Infra services (hosting php.net worldwide) – Human management – … lots of things to do
  • 19. PHP 5.5 new features ● Password hashing API ● "Finally" keyword ● Generators ● Syntax and engine improvements ● Breaks, deprecations ● … more not reported here
  • 20. New Password hashing API ● PHP users don't really understand/care about the concept behing hashing, salting and crypting ● PHP doesn't give any hints about that ● User are left on their own – Until 5.5 version – Welcome a new password hashing API !
  • 21. New Password hashing API ● https://wiki.php.net/rfc/password_hash ● See how easy that looks now : – To generate a hash $password = 'secret'; $hash = password_hash($password, PASSWORD_DEFAULT); var_dump($hash); // "$2y$10$Pa2cIqH5X3m6iqIYVDBdvOUcggnXnZzBy0dlie 4VRHLr3ncLcyB7a"
  • 22. New Password hashing API ● https://wiki.php.net/rfc/password_hash ● See how easy that looks now : – To verify a hash $provided_password = 'secret'; $hash = "$2y$10$Pa2cIqH5X3m6iqIYVDBdvOUcggnXnZzBy0 dlie4VRHLr3ncLcyB7a"; if (password_verify($provided_password, $hash)) { echo "you are welcome" ; }
  • 23. New Password hashing API ● More options : – choose your hashing algorithm – choose a salt from yours – choose a CPU cost $password = "mysecret" ; $hash =password_hash($password, PASSWORD_BCRYPT, array("cost" => 5, "salt" => "my_secret_salt") ) ;
  • 24. New Password hashing API ● Just one Database field is needed ● The hash encapsulates all the infos – algorithm used – salt used – cost used – hash itself "$2y$10$Pa2cIqH5X3m6iqIYVDBdvOUcggnXnZzBy0dlie4VR...
  • 25. Other changes ● ext/intl has been massively worked on / improved ● ext/curl up to date with new libcurl ● bison < 2.4 no longer supported (parser) ● libpcre updated ● array_column() ● cli_set_process_title() ● Lots of bug fixes
  • 27. foreach() changes ● Foreach now supports list() ● https://wiki.php.net/rfc/foreachlist $users = array( array('Foo', 'Bar'), array('Baz', 'Qux'); ); // Before foreach ($users as $user) { list($firstName, $lastName) = $user; echo "First name: $firstName, last name: $lastName. "; } // After foreach ($users as list($firstName, $lastName)) { echo "First name: $firstName, last name: $lastName. "; }
  • 28. Array dereferencing strings ● Dereference const expressions ● https://wiki.php.net/rfc/constdereference var_dump( "php"[1] ); // 'h' var_dump( [1, 2, 3][1] ); // 2 var_dump( [ ['foo, 'bar'], [1, 2] ] [0][1] ); // "bar"
  • 29. OPCache ● OPCache = "ZendOptimizerPlus" for PHP – It's been freed by Zend recently – It's then been renamed ● OPCache will be shipped with PHP 5.5 , as an extension you have to activate at compile time – it will be maintained together with PHP itself ● APC is now dead
  • 30. OPCache roles ● OPCode caching + optimizing
  • 32. PHP 5.5 compatibility breaks ● ext/mysql has been deprecated /! ● /e modifier for preg() has been deprecated ● Dropped support for Windows XP and 2k3 ● No more php logo and zend logo functions ● pack()/unpack() minor changes
  • 33. Performances ? ● The biggest step was 5.3 to 5.4 – First time for such a boost ● 5.5 is faster than 5.4 – But don't expect the same effect than 5.3 to 5.4
  • 34. Performances ● Testing blablacar.com – PHPUnit 3.7.21 – 959 tests – (Lots of external services and SQL) Time: 14:32, Memory: 1202.50Mb Time: 12:48, Memory: 995.50Mb Time: 12:30, Memory: 996.50Mb 5.3.latest 5.4.latest 5.5.latest
  • 35. Engine performance ● PHP 5.3.latest empty_loop 0.161 func() 0.459 0.298 undef_func() 0.469 0.309 int_func() 0.446 0.285 $x = self::$x 0.444 0.284 self::$x = 0 0.441 0.281 isset(self::$x) 0.431 0.270 empty(self::$x) 0.443 0.283 $x = Foo::$x 0.586 0.425 Foo::$x = 0 0.808 0.647 isset(Foo::$x) 0.578 0.417 empty(Foo::$x) 0.590 0.429 self::f() 0.716 0.555 Foo::f() 0.752 0.591 $x = $this->x 0.426 0.265 $this->x = 0 0.497 0.337 $this->x += 2 0.439 0.279 ++$this->x 0.381 0.220 --$this->x 0.404 0.244 $this->x++ 0.411 0.251 $this->x-- 0.415 0.254 isset($this->x) 0.423 0.263 empty($this->x) 0.433 0.272 $this->f() 0.610 0.449 $x = Foo::TEST 0.353 0.193 new Foo() 1.763 1.602 $x = TEST 0.371 0.211 $x = $_GET 0.361 0.200 $x = $GLOBALS['v'] 0.501 0.341 $x = $hash['v'] 0.355 0.194 $x = $str[0] 0.660 0.499 $x = $a ?: null 2.139 1.978 $x = $f ?: tmp 0.435 0.274 $x = $f ? $f : $a 2.141 1.980 $x = $f ? $f : tmp 0.418 0.258 Total 21.259
  • 36. Engine performance ● PHP 5.4.latest empty_loop 0.117 func() 0.380 0.263 undef_func() 0.377 0.260 int_func() 0.336 0.219 $x = self::$x 0.361 0.245 self::$x = 0 0.331 0.214 isset(self::$x) 0.232 0.116 empty(self::$x) 0.243 0.127 $x = Foo::$x 0.327 0.210 Foo::$x = 0 0.217 0.100 isset(Foo::$x) 0.279 0.162 empty(Foo::$x) 0.216 0.100 self::f() 0.398 0.281 Foo::f() 0.365 0.248 $x = $this->x 0.363 0.246 $this->x = 0 0.322 0.205 $this->x += 2 0.252 0.136 ++$this->x 0.220 0.103 --$this->x 0.224 0.107 $this->x++ 0.248 0.132 $this->x-- 0.252 0.135 isset($this->x) 0.232 0.115 empty($this->x) 0.251 0.135 $this->f() 0.423 0.307 $x = Foo::TEST 0.220 0.103 new Foo() 0.821 0.705 $x = TEST 0.169 0.052 $x = $_GET 0.256 0.140 $x = $GLOBALS['v'] 0.450 0.334 $x = $hash['v'] 0.355 0.238 $x = $str[0] 0.369 0.252 $x = $a ?: null 0.235 0.118 $x = $f ?: tmp 0.330 0.213 $x = $f ? $f : $a 0.245 0.129 $x = $f ? $f : tmp 0.334 0.217 Total 10.749
  • 37. Engine performance ● PHP 5.5.latest empty_loop 0.117 func() 0.396 0.279 undef_func() 0.415 0.298 int_func() 0.325 0.208 $x = self::$x 0.286 0.169 self::$x = 0 0.399 0.282 isset(self::$x) 0.237 0.120 empty(self::$x) 0.282 0.165 $x = Foo::$x 0.246 0.129 Foo::$x = 0 0.320 0.203 isset(Foo::$x) 0.203 0.086 empty(Foo::$x) 0.248 0.131 self::f() 0.433 0.316 Foo::f() 0.395 0.278 $x = $this->x 0.249 0.132 $this->x = 0 0.320 0.203 $this->x += 2 0.251 0.134 ++$this->x 0.309 0.192 --$this->x 0.223 0.106 $this->x++ 0.248 0.131 $this->x-- 0.258 0.141 isset($this->x) 0.236 0.119 empty($this->x) 0.262 0.145 $this->f() 0.438 0.321 $x = Foo::TEST 0.225 0.107 new Foo() 0.825 0.708 $x = TEST 0.177 0.060 $x = $_GET 0.262 0.145 $x = $GLOBALS['v'] 0.357 0.240 $x = $hash['v'] 0.267 0.150 $x = $str[0] 0.368 0.251 $x = $a ?: null 0.233 0.115 $x = $f ?: tmp 0.317 0.200 $x = $f ? $f : $a 0.254 0.137 $x = $f ? $f : tmp 0.318 0.201 Total 10.700
  • 38. Thank you for listening !