Slide 1

Slide 1 text

PHP 7.3

Slide 2

Slide 2 text

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

Slide 3

Slide 3 text

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

Slide 4

Slide 4 text

New Stuff 4/23

Slide 5

Slide 5 text

Array Functions ! $arr = [ 'a' => 'bob', 'b' => 'jane', 'c' => 'john', ]; array_key_first($arr); // a array_key_last($arr); // c 5/23

Slide 6

Slide 6 text

is_countable() ! $a = 'not-an-array'; count($a); // gives warning if (is_countable($a)) { // better count($a); } 6/23

Slide 7

Slide 7 text

High-Resolution Time ⏱ $timeAsInt = hrtime(); /* array(2) { [0]=> int(27310) [1]=> int(349104398) } */ $timeAsArray = hrtime($asInteger = true); // int(27310349207961) 7/23

Slide 8

Slide 8 text

Releaxed Heredoc / Nowdoc Syntax $awesomeText = <<

Slide 9

Slide 9 text

Trailing Commas In Function/Method Calls $bitcoins = mineForBitcoins(2.500, 8, ); // here function mineForBitcoins($amount, $cores) { // but not here ... } 9/23

Slide 10

Slide 10 text

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

Slide 11

Slide 11 text

References in list() ! $array = ['bob', 'jane']; list($a, &$b) = $array; $b = 'john'; echo $array[1]; // "john" 11/23

Slide 12

Slide 12 text

PCRE2 ! preg_match('/[\w-.]+/', ''); // throws compilation failed error // we need to escape the hyphen too preg_match('/[\w\-.]+/', ''); // ok 12/23

Slide 13

Slide 13 text

Argon2 Password Hash Enhancements ✳✳✳✳✳ Argon2id is a hybrid of Argon2i and Argon2d. password_hash('super-secret', PASSWORD_ARGON2ID, $options = []); 13/23

Slide 14

Slide 14 text

Depracations 14/23

Slide 15

Slide 15 text

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

Slide 16

Slide 16 text

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

Slide 17

Slide 17 text

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

Slide 18

Slide 18 text

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

Slide 19

Slide 19 text

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

Slide 20

Slide 20 text

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

Slide 21

Slide 21 text

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

Slide 22

Slide 22 text

Questions ! Slides can be found at https://speakerdeck.com/mazedlx 22/23

Slide 23

Slide 23 text

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