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

PHP73.pdf

 PHP73.pdf

E157a71a8b1585e6a33e2c6da01d4cac?s=128

Christian Leo-Pernold

November 05, 2018
Tweet

More Decks by Christian Leo-Pernold

Other Decks in Technology

Transcript

  1. PHP 7.3

  2. ! Christian Leo-Pernold " @mazedlx ⭐ https://github.com/mazedlx $ https://mazedlx.net 2/23

  3. Agenda New Stuff ! Depractions " Release Schedule # 3/23

  4. New Stuff 4/23

  5. Array Functions ! $arr = [ 'a' => 'bob', 'b'

    => 'jane', 'c' => 'john', ]; array_key_first($arr); // a array_key_last($arr); // c 5/23
  6. is_countable() ! $a = 'not-an-array'; count($a); // gives warning if

    (is_countable($a)) { // better count($a); } 6/23
  7. High-Resolution Time ⏱ $timeAsInt = hrtime(); /* array(2) { [0]=>

    int(27310) [1]=> int(349104398) } */ $timeAsArray = hrtime($asInteger = true); // int(27310349207961) 7/23
  8. Releaxed Heredoc / Nowdoc Syntax $awesomeText = <<<HOBBIT In a

    hole in the ground there lived a hobbit. Not a nasty, dirty, wet hole, filled with the ends of worms and an oozy smell, nor yet a dry, bare, sandy hole with nothing in it to sit down on or to eat: it was a hobbit-hole, and that means comfort HOBBIT // finally some indentation 8/23
  9. Trailing Commas In Function/Method Calls $bitcoins = mineForBitcoins(2.500, 8, );

    // here function mineForBitcoins($amount, $cores) { // but not here ... } 9/23
  10. json_encode()/json_decode() Can Throw Exceptions try { json_decode("{", $assoc = false,

    $depth = 512, JSON_THROW_ON_ERROR); } catch (\JsonException $exception) { echo $exception->getMessage(); // "Syntax error" } 10/23
  11. References in list() ! $array = ['bob', 'jane']; list($a, &$b)

    = $array; $b = 'john'; echo $array[1]; // "john" 11/23
  12. PCRE2 ! preg_match('/[\w-.]+/', ''); // throws compilation failed error //

    we need to escape the hyphen too preg_match('/[\w\-.]+/', ''); // ok 12/23
  13. Argon2 Password Hash Enhancements ✳✳✳✳✳ Argon2id is a hybrid of

    Argon2i and Argon2d. password_hash('super-secret', PASSWORD_ARGON2ID, $options = []); 13/23
  14. Depracations 14/23

  15. Depracate and remove image2wbmp() // fix: replace image2wbmp() with imagewbmp()

    15/23
  16. Undocumented mbstring function aliases //fix: use mb_ereg() instead of mbereg()

    16/23
  17. String search functions with integer needles $str = 'In a

    hole in the ground there lived 1 hobbit.'; strpos($str, '1'); // int(36) strpos($str, 1); // bool(false) 17/23
  18. Depracate case-insensitive constants define('Foo', 'Bar', $caseInsensitive = true); // throws

    a depracation notice define('Foo', 'Bar'); echo Foo; // 'Bar' echo foo; // throws a depracation notice // By convention, constants should be all UPPERCASE 18/23
  19. Depracate FILTER_FLAG_SCHEME_REQUIRED and FILTER_FLAG_HOST_REQUIRED with FILTER_VALIDATE_URL filter_var( $var, FILTER_VALIDATE_URL, FILTER_FLAG_SCHEME_REQUIRED,

    FILTER_FLAG_HOST_REQUIRED ) // throws depracation warning // fix filter_var($var, FILTER_VALIDATE_URL); 19/23
  20. pdo_odbc.db2_instance_name directive As of PHP 5.1.1 pdo_odbc.db2_instance_name was marked as

    deprecated in the manual, promising removal in a future version of PHP. This ini directive modifies the DB2INSTANCE environment variable for non Windows operating systems, allowing pdo_odbc to make cataloged connections to a DB2 database. 20/23
  21. Release Schedule ! Date Release Jun 07 2018 Alpha 1

    ... ... Jul 31 2018 PHP 7.3 branched/Feature freeze Aug 02 2018 Beta 1 ... ... Sep 13 2018 RC 1 ... ... Nov 08 2018 RC 5 Nov 20 2018 PHP 7.3.0 branched Nov 22 2018 RC 6 Dec 13 2018 GA 21/23
  22. Questions ! Slides can be found at https://speakerdeck.com/mazedlx 22/23

  23. repod.at — Der Podcast mit Franky und Christian. Auf geschert.

    23/23