Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Last Month in PHP - November 2012

John Kary
November 17, 2012

Last Month in PHP - November 2012

Kansas City PHP User Group
November 17, 2012

John Kary

November 17, 2012
Tweet

More Decks by John Kary

Other Decks in Programming

Transcript

  1. Last Month in PHP November 16, 2012 Kansas City PHP

    User Group John Kary @johnkary Slides: http://johnkary.net/talks
  2. PHP 5.5.0-alpha1 • Generators • New simplified password hashing API

    https://github.com/php/php-src/blob/php-5.5.0alpha1/NEWS
  3. <?php $password = password_hash('rasmuslerdorf', PASSWORD_BCRYPT, array( 'cost' => 7, 'salt'

    => 'usesomesillystringfor', )); var_dump($password); string(60) "$2y$07$usesomesillystringfore2uDLvp1Ii2e./U9C8sBjqp8I90dH6hi" Password Hashing API
  4. $password = password_hash('rasmuslerdorf', PASSWORD_BCRYPT, array( 'cost' => 7, 'salt' =>

    'usesomesillystringfor', )); Password Hashing API $2y$07$usesomesillystringfore2uDLvp1Ii2e./U9C8sBjqp8I90dH6hi Hashing Algorithm Cost Salt Hash
  5. <?php $password = "foo"; $hash = password_hash($password, PASSWORD_BCRYPT); // Store

    Hash if (password_verify($password, $hash)) { // Password Is Correct } else { // Password Is Not Correct } Verify Password
  6. PHP 5.5.0-alpha1 • Generators • New simplified password hashing API

    • Added finally in try/catch blocks https://github.com/php/php-src/blob/php-5.5.0alpha1/NEWS
  7. <?php $db = mysqli_connect(); try { call_some_function($db); } catch (Exception

    $e) { mysqli_close($db); throw $e; } mysql_close($db); finally in try/catch blocks BEFORE
  8. <?php $db = mysqli_connect(); try { //the function may throw

    exceptions which we can not handle call_some_function($db); } finally { mysqli_close($db); } finally in try/catch blocks AFTER
  9. <?php function vroom() { try { return 2; } finally

    { echo "Executed finally\n"; } //this will never be called echo "Hi!"; } $php = vroom(); var_dump($php); // Outputs: Executed finally int(2) finally in try/catch blocks
  10. PHP 5.5.0-alpha1 • Generators • New simplified password hashing API

    • Added finally in try/catch blocks • Support for list() in foreach https://github.com/php/php-src/blob/php-5.5.0alpha1/NEWS
  11. <?php $users = array( array('John', 'Kary'), array('Dan', 'Holmes'), ); foreach

    ($users as $user) { list($firstName, $lastName) = $user; echo "First name: $firstName, last name: $lastName. "; } foreach ($users as list($firstName, $lastName)) { echo "First name: $firstName, last name: $lastName. "; } list() in foreach BEFORE AFTER
  12. PHP 5.5.0-alpha1 • Generators • New simplified password hashing API

    • Added finally in try/catch blocks • Support for list() in foreach • Constant array/string dereferencing https://github.com/php/php-src/blob/php-5.5.0alpha1/NEWS
  13. <?php function getUsers() { return array( 'John', 'Dan', 'Noah', );

    } echo getUsers()[2]; // Noah Constant array/string dereferencing
  14. PHP 5.5.0-alpha1 • Generators • New simplified password hashing API

    • Added finally in try/catch blocks • Support for list() in foreach • Constant array/string dereferencing • ext/intl improvements • Dropped support for Windows XP or Server 2003 https://github.com/php/php-src/blob/php-5.5.0alpha1/NEWS
  15. Zendcon.com • Some videos posted: youtube.com/user/ZendTechnologies • Matthew Weier O'Phinney

    • Designing Beautiful Software • bit.ly/beautiful-software-zendcon12
  16. http://bit.ly/lawrence-coders-hack-day12 • Thursday, November 29, 2012, 6-9pm • Lawrence Public

    Library - Auditorium • Show up and learn from each other! • FREE! Pizza provided. Hack Day
  17. http://meetu.ps/lypBT • Saturday, December 8, 2012, 8:30-5:00pm • $20 deposit,

    refunded at event (FREE) • Held at Cerner in KC KC Ruby: Global day of Coderetreat
  18. SunshinePHP.com • February 8-9, 2013 • Held in sunny Miami,

    Florida • South Florida PHP User Group / ServerGrove • $160 before November 30 ($220 after) • $159 for Students • 36 sessions, 12 will be Symfony-focused • Escape the cold Kansas winter!