Your SlideShare is downloading. ×
0
PHP 5.5
Whats New!!

Presented By : Naseer Ahmad
Performance and Memory
Performance by 10-30%
Memory by 50%
●
●

precompiled script bytecode in shared memory
reduction in ...
New Features
● Finally keyword.
● foreach supporting lists now.
<?php
$array = [
[1, 2],
[3, 4],
];
foreach ($array as lis...
New Features
● empty() supports arbitrary expression.
● Class name resolution via ::class
<?php
namespace NameSpace;
class...
New Features(Array & String Direct Referencing)
<?php
echo 'Array dereferencing: ';
echo [1, 2, 3][0];

Print : Array dere...
New Features(Generators)
●
●
●
●

Routine to control the iteration of a loop
Sequence of values in loop
Values on demand
I...
New Features(Generators)

Fine for normal usage
What if we want to abstract it?
Generators
New Features(Generators)

Simpler, lesser code
New Features(Password Hashing Api)
> Php 5.5
Relying on
● custom hash methods
● somewhat confusing crypt() method

Php 5.5...
<?php
$timeTarget = 0.2;
$cost = 9;
do {
$cost++;
$start = microtime(true);
password_hash("test", PASSWORD_BCRYPT, ["cost"...
New Features(Password Hashing Api)
● password_get_info — Returns information about the
given hash
● password_hash — Create...
New Features(Password Hashing Api)
<?php
$hash = password_hash(‘MyPassword’, PASSWORD_DEFAULT);
if(password_verify(‘MyPass...
References
http://be1.php.net/migration55.new-features
http://www.sitepoint.com/generators-in-php/
http://geekmonkey.org/a...
Php 5.5
Upcoming SlideShare
Loading in...5
×

Php 5.5

336

Published on

New features in php 5.5

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
336
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
16
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Transcript of "Php 5.5"

  1. 1. PHP 5.5 Whats New!! Presented By : Naseer Ahmad
  2. 2. Performance and Memory Performance by 10-30% Memory by 50% ● ● precompiled script bytecode in shared memory reduction in loading and parsing of scripts on every request HOW??? !! Zend Optimizer & opcode cache !! Available in PECL for PHP versions 5.2, 5.3 and 5.4
  3. 3. New Features ● Finally keyword. ● foreach supporting lists now. <?php $array = [ [1, 2], [3, 4], ]; foreach ($array as list($a, $b)) { echo "A: $a; B: $bn"; } ?>
  4. 4. New Features ● empty() supports arbitrary expression. ● Class name resolution via ::class <?php namespace NameSpace; class ClassName {} echo ClassName::class; //NameSpaceClassName ?>
  5. 5. New Features(Array & String Direct Referencing) <?php echo 'Array dereferencing: '; echo [1, 2, 3][0]; Print : Array dereferencing : 1 echo "n"; echo 'String dereferencing: '; echo 'PHP'[0]; echo "n"; ?> Print : String dereferencing: P
  6. 6. New Features(Generators) ● ● ● ● Routine to control the iteration of a loop Sequence of values in loop Values on demand In simple words, put foreach over a function :)
  7. 7. New Features(Generators) Fine for normal usage What if we want to abstract it?
  8. 8. Generators
  9. 9. New Features(Generators) Simpler, lesser code
  10. 10. New Features(Password Hashing Api) > Php 5.5 Relying on ● custom hash methods ● somewhat confusing crypt() method Php 5.5 Hashing api, wrapper around crypt() No external libraries,no additional installation PASSWORD_BCRYPT hashing algorithm, 60 characters hash. Salt and Cost options.
  11. 11. <?php $timeTarget = 0.2; $cost = 9; do { $cost++; $start = microtime(true); password_hash("test", PASSWORD_BCRYPT, ["cost" => $cost]); $end = microtime(true); } while (($end - $start) < $timeTarget); echo "Appropriate Cost Found: " . $cost; //Appropriate Cost Found: 11 ?>
  12. 12. New Features(Password Hashing Api) ● password_get_info — Returns information about the given hash ● password_hash — Creates a password hash ● password_needs_rehash — Checks if the given hash matches the given options ● password_verify — Verifies that a password matches a hash
  13. 13. New Features(Password Hashing Api) <?php $hash = password_hash(‘MyPassword’, PASSWORD_DEFAULT); if(password_verify(‘MyPassword’, $hash)){ echo “Password is valid!!”; } else{ echo “invalid password.”} ?>
  14. 14. References http://be1.php.net/migration55.new-features http://www.sitepoint.com/generators-in-php/ http://geekmonkey.org/articles/39-php-5-5-generators http://blog.ircmaxell.com/2012/07/what-generators-can-do-for-you.html http://blog.asmallorange.com/2013/08/php-roadmap-performance/ http://php.net/manual/en/function.password-hash.php http://uk1.php.net/manual/en/book.opcache.php https://support.cloud.engineyard.com/entries/26902267-PHP-Performance-IEverything-You-Need-to-Know-About-OpCode-Caches
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×