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

    View Slide

  2. Releases

    View Slide

  3. New PHP versions
    5.5.0-alpha1

    View Slide

  4. PHP 5.5.0-alpha1
    • Generators
    • New simplified password hashing API
    https://github.com/php/php-src/blob/php-5.5.0alpha1/NEWS

    View Slide

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

    View Slide

  6. $password = password_hash('rasmuslerdorf', PASSWORD_BCRYPT, array(
    'cost' => 7,
    'salt' => 'usesomesillystringfor',
    ));
    Password Hashing API
    $2y$07$usesomesillystringfore2uDLvp1Ii2e./U9C8sBjqp8I90dH6hi
    Hashing
    Algorithm
    Cost Salt Hash

    View Slide

  7. $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

    View Slide

  8. 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

    View Slide

  9. $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

    View Slide

  10. $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

    View Slide

  11. 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

    View Slide

  12. 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

    View Slide

  13. $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

    View Slide

  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
    https://github.com/php/php-src/blob/php-5.5.0alpha1/NEWS

    View Slide

  15. function getUsers() {
    return array(
    'John',
    'Dan',
    'Noah',
    );
    }
    echo getUsers()[2]; // Noah
    Constant
    array/string
    dereferencing

    View Slide

  16. 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

    View Slide

  17. Latest Developments

    View Slide

  18. +
    Twig in Drupal 8

    View Slide

  19. Conferences / Events

    View Slide

  20. Zendcon.com
    • Some videos posted: youtube.com/user/ZendTechnologies
    • Matthew Weier O'Phinney
    • Designing Beautiful Software
    • bit.ly/beautiful-software-zendcon12

    View Slide

  21. 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

    View Slide

  22. 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

    View Slide

  23. 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!

    View Slide

  24. fin
    http://johnkary.net/talks

    View Slide