com presentations: Drop 7.0 feature slide: phpkonf.html phpkonf.xml
| From: | Rasmus Lerdorf | Date: | Sat, 20 May 2017 03:46:47 +0000 |
| Subject: | com presentations: Drop 7.0 feature slide: phpkonf.html phpkonf.xml | ||
| Groups: | php.pres | ||
| Request: | Send a blank email to pres+get-2222@lists.php.net to get a copy of this message | ||
Commit: d880db914e7f968252905fd72a0772a5c533b3a0
Author: Rasmus Lerdorf <rasmus@php.net> Sat, 20 May 2017 06:46:47 +0300
Parents: 3b4eeec5dd2da787b7aa98ef6ce6f57954567079
Branches: master
Link: http://git.php.net/?p=presentations.git;a=commitdiff;h=d880db914e7f968252905fd72a0772a5c533b3a0
Log:
Drop 7.0 feature slide
Changed paths:
M phpkonf.html
M phpkonf.xml
diff --git a/phpkonf.html b/phpkonf.html index f643588..97a95a4 100644 --- a/phpkonf.html +++ b/phpkonf.html @@ -420,228 +420,6 @@ $ make -j8 prof-use</code></pre> <h1 style="text-align:center;">Upgrade to PHP 7!</h1> </section> </section> <section> - <section id="php7"> - <img src="/presentations/slides/intro/php7trans-200.png" width="" height=""> - <p class="p" style="font-size:1.1em;text-align:left;">engine improvements</p> - <ul> - <li style="font-size: 1em;">100%+ performance gain on most real-world applications</li> - <li style="font-size: 1em;">Lower memory usage, sometimes drastically lower</li> - </ul> - </section> -<section id="php7excep"> - <p class="p" style="font-size:1.1em;text-align:left;">Exceptions on Fatals</p> - <pre><code data-trim style="font-size:1.1em;" >function call_method($obj) { - $obj->method(); -} -call_method(null);</code></pre> - <pre><code class="shell nohighlight" data-trim style="font-size:0.85em;" >Fatal error: Uncaught Error: Call to a member function method() on null in file:2 -Stack trace: -#0 file(4): call_method(NULL) -#1 {main} - thrown in file on line 2</code></pre> - <pre><code data-trim style="font-size:1.1em;" >try { - call_method(null); -} catch (Error $e) { - echo "Caught Exception: {$e->getMessage()}\n"; -}</code></pre> - <pre><code class="shell nohighlight" data-trim style="font-size:0.85em;" >Caught Exception: Call to a member function method() on null</code></pre> - </section> -<section id="php7hier"> - <p class="p" style="font-size:2em;text-align:center;">PHP 7 Exception Hierarchy</p> -<br/> - <ul> - <li style="font-size: 1.5em;list-style-type: none;"><font color="ab5c5c">Throwable</font></li> - <li style="font-size: 1.25em;margin-left: 2em;list-style-type: none;">➥ <font color="ab5c5c">Exception</font> implements Throwable</li> - <li style="font-size: 1.25em;margin-left: 2em;list-style-type: none;">➥ <font color="ab5c5c">Error</font> implements Throwable</li> - <li style="font-size: 1em;margin-left: 4em;list-style-type: none;">➥ <font color="ab5c5c">TypeError</font> extends Error</li> - <li style="font-size: 1em;margin-left: 4em;list-style-type: none;">➥ <font color="ab5c5c">ParseError</font> extends Error</li> - </ul> - </section> -<section id="php7ret"> - <p class="p" style="font-size:1.1em;text-align:left;">Return Types</p> - <pre><code data-trim style="font-size:1.1em;" >function get_config(): array { - return 42; -} -get_config();</code></pre> - <pre><code class="shell nohighlight" data-trim style="font-size:0.9em;" >Fatal error: Uncaught TypeError: Return value of get_config() must be -of the type array, integer returned in file:2 -Stack trace: -#0 file(4): get_config() -#1 {main} - thrown in file on line 2</code></pre> - </section> -<section id="php7STH"> - <p class="p" style="font-size:1.1em;text-align:left;">Coercive Scalar Types</p> - <pre><code data-trim style="font-size:1.1em;" >function logmsg(string $msg, int $level, float $severity) { - var_dump($msg); // string(1) "1" - var_dump($level); // int(2) - var_dump($severity); // float(3) -} -logmsg(1, "2.5 bananas", 3);</code></pre> - <pre><code class="shell nohighlight" data-trim style="font-size:0.9em;" >Notice: A non well formed numeric value encountered in file on line 2</code></pre> - <p class="p" style="font-size:1.1em;text-align:left;">Strict Scalar Types</p> - <pre><code data-trim style="font-size:1.1em;" >declare(strict_types=1); -... -logmsg(1, "2.5", 3);</code></pre> - <pre><code class="shell nohighlight" data-trim style="font-size:0.9em;" >Fatal error: Uncaught TypeError: Argument 1 passed to logmsg() must be of the -type string, integer given, called in file on line 7 and defined in file:3 -Stack trace: -#0 file(7): logmsg(1, '2.5', 3) -#1 {main} - thrown in file on line 2</code></pre> - </section> -<section id="php7anon"> - <p class="p" style="font-size:1.1em;text-align:left;">Anonymous Classes</p> - <pre><code data-trim style="font-size:1.2em;" >return new class($controller) implements Page { - public function __construct($controller) { - /* ... */ - } - /* ... */ -}; - -class MyObject extends MyStuff { - public function getInterface() { - return new class implements MyInterface { - /* ... */ - }; - } -}</code></pre> - </section> -<section id="php7coalesce"> - <p class="p" style="font-size:1.1em;text-align:left;">Coalesce Operator</p> - <pre><code data-trim style="font-size:1.5em;" >$a = NULL; -$b = 0; -$c = 2; - -echo $a ?? $b; // 0 -echo $c ?? $b; // 2 -echo $a ?? $b ?? $c; // 0 -echo $a ?? $x ?? $c; // 2</code></pre> - </section> -<section id="Spaceship"> - <p class="p" style="font-size:1.1em;text-align:left;">Spaceship Operator</p> - <img src="/presentations/slides/intro/lego-php-astronaut.png" width="230" height="345"> - <pre><code data-trim style="font-size:1.1em;" >function cmp_php5($a, $b) { - return ($a < $b) ? -1 : (($a >$b) ? 1 : 0); -} - -function cmp_php7($a, $b) { - return $a <=> $b; -}</code></pre> - </section> -<section id="php7cleanups"> - <p class="p" style="font-size:1.1em;text-align:left;">Removal of many deprecated features<BR/> - (Your PHP4 code will break!)</p> - <pre><code data-trim >- ext/ereg (use ext/pcre instead) -- preg_replace() eval modifier (use preg_replace_callback() instead) -- ext/mysql (use ext/mysqli or ext/pdo_mysql instead) -- Assignment of new by reference -- Scoped calls of non-static methods from incompatible $this context - -- dl() in php-fpm -- set_magic_quotes_runtime() and magic_quotes_runtime() -- set_socket_blocking() (use stream_set_blocking() instead) -- mcrypt_generic_end() (use mcrypt_generic_deinit() instead) -- mcrypt_ecb, mcrypt_cbc, mcrypt_cfb and mcrypt_ofb - (use mcrypt_encrypt() and mcrypt_decrypt() instead) -- datefmt_set_timezone_id() and IntlDateFormatter::setTimeZoneID() - (use datefmt_set_timezone() or IntlDateFormatter::setTimeZone() instead) - -- xsl.security_prefs (use XsltProcessor::setSecurityPrefs() instead) -- iconv.input_encoding, iconv.output_encoding, iconv.internal_encoding, - mbstring.http_input, mbstring.http_output and mbstring.internal_encoding - (use php.input_encoding, php.internal_encoding and php.output_encoding instead) - -- $is_dst parameter of the mktime() and gmmktime() functions -- # style comments in ini files (use ; style comments instead) -- String category names in setlocale() (use LC_* constants instead) -- Unsafe curl file uploads (use CurlFile instead) -- PDO::PGSQL_ATTR_DISABLE_NATIVE_PREPARED_STATEMENT driver option - (use PDO::ATTR_EMULATE_PREPARES instead) -- CN_match and SNI_server_name stream context option (use peer_name instead)</code></pre> - </section> -<section id="php7reserved"> - <p class="p" style="font-size:1.1em;text-align:left;">New reserved words:</p> - <ul> - <li style="font-size: 1em;list-style-type: none;">bool</li> - <li style="font-size: 1em;list-style-type: none;">int</li> - <li style="font-size: 1em;list-style-type: none;">float</li> - <li style="font-size: 1em;list-style-type: none;">string</li> - <li style="font-size: 1em;list-style-type: none;">null</li> - <li style="font-size: 1em;list-style-type: none;">false</li> - <li style="font-size: 1em;list-style-type: none;">true</li> - <li style="font-size: 1em;list-style-type: none;">resource</li> - <li style="font-size: 1em;list-style-type: none;">object</li> - <li style="font-size: 1em;list-style-type: none;">mixed</li> - <li style="font-size: 1em;list-style-type: none;">numeric</li> - </ul> - </section> -<section id="php7num"> - <p class="p" style="font-size:1.1em;text-align:left;">64-bit integer support on Windows</p> - <p class="p" style="font-size:1.1em;text-align:left;">Cleanup edge-case integer overflow/underflow</p> - <p class="p" style="font-size:1.1em;text-align:left;">Support for strings with length >= 2^31 bytes in 64 bit builds.</p> - <p class="p" style="font-size:1.1em;text-align:left;">Parse error on invalid numeric literals</p> - <pre><code data-trim >$mask = 0855; // Parse error: Invalid numeric literal</code></pre> - </section> -<section id="php7UVS"> - <p class="p" style="font-size:1.1em;text-align:left;">Uniform variable syntax</p> - <pre><code data-trim >// left-to-right -$this->$belongs_to['column'] -// vs. -$this->{$belongs_to['column']} - -// support missing combinations of operations -$foo()['bar']() -[$obj1, $obj2][0]->prop -getStr(){0} - -// support nested :: -$foo['bar']::$baz -$foo::$bar::$baz -$foo->bar()::baz() - -// support nested () -foo()() -$foo->bar()() -Foo::bar()() -$foo()() - -// support operations on arbitrary (...) expressions -(...)['foo'] -(...)->foo -(...)->foo() -(...)::$foo -(...)::foo() -(...)() - -// two more practical examples for the last point -(function() { ... })() -($obj->closure)() - -// support all operations on dereferencable scalars -// (not very useful) -"string"->toLower() -[$obj, 'method']() -'Foo'::$bar</code></pre> - </section> -<section id="php7unicode"> - <p class="p" style="font-size:1.1em;text-align:left;">Unicode Codepoint Escape Syntax</p> - <pre><code data-trim style="font-size:1.2em;" >echo "\u{202E}Right-to-left text"; - -echo " \u{26BD}";</code></pre> - <pre class="output" style="font-size:1.2em;">Right-to-left text ⚽ </pre> <p class="p" style="font-size:1.1em;text-align:left;">ICU IntlChar class added to intl extension</p> - </section> -<section id="php7csprng"> - <p class="p" style="font-size:1.1em;text-align:left;">CSPRNG</p> - <pre><code data-trim style="font-size:1.2em;" >$int = random_int(-500, 500); -$bytes = random_bytes(10); - -var_dump( $int ); -var_dump( bin2hex($bytes) );</code></pre> - <pre class="output" style="font-size:1.2em;">int(98) -string(20) "1fe3d208d5e341b0acce" - </pre> </section> </section> - <section> <section id="php71"> <h1 style="text-align:center;">PHP 7.1</h1> </section> diff --git a/phpkonf.xml b/phpkonf.xml index d025528..8df3b66 100644 --- a/phpkonf.xml +++ b/phpkonf.xml @@ -39,7 +39,6 @@ <slide>slides/intro/php7prod.xml</slide> <slide>slides/intro/web_impact.xml</slide> -<slide>slides/intro/php7_2017.xml</slide> <slide>slides/intro/php71_2017.xml</slide> <slide>slides/intro/phan_2017.xml</slide> <slide>slides/intro/phan_ts.xml</slide>
diff --git a/phpkonf.html b/phpkonf.html index f643588..97a95a4 100644 --- a/phpkonf.html +++ b/phpkonf.html @@ -420,228 +420,6 @@ $ make -j8 prof-use</code></pre> <h1 style="text-align:center;">Upgrade to PHP 7!</h1> </section> </section> <section> - <section id="php7"> - <img src="/presentations/slides/intro/php7trans-200.png" width="" height=""> - <p class="p" style="font-size:1.1em;text-align:left;">engine improvements</p> - <ul> - <li style="font-size: 1em;">100%+ performance gain on most real-world applications</li> - <li style="font-size: 1em;">Lower memory usage, sometimes drastically lower</li> - </ul> - </section> -<section id="php7excep"> - <p class="p" style="font-size:1.1em;text-align:left;">Exceptions on Fatals</p> - <pre><code data-trim style="font-size:1.1em;" >function call_method($obj) { - $obj->method(); -} -call_method(null);</code></pre> - <pre><code class="shell nohighlight" data-trim style="font-size:0.85em;" >Fatal error: Uncaught Error: Call to a member function method() on null in file:2 -Stack trace: -#0 file(4): call_method(NULL) -#1 {main} - thrown in file on line 2</code></pre> - <pre><code data-trim style="font-size:1.1em;" >try { - call_method(null); -} catch (Error $e) { - echo "Caught Exception: {$e->getMessage()}\n"; -}</code></pre> - <pre><code class="shell nohighlight" data-trim style="font-size:0.85em;" >Caught Exception: Call to a member function method() on null</code></pre> - </section> -<section id="php7hier"> - <p class="p" style="font-size:2em;text-align:center;">PHP 7 Exception Hierarchy</p> -<br/> - <ul> - <li style="font-size: 1.5em;list-style-type: none;"><font color="ab5c5c">Throwable</font></li> - <li style="font-size: 1.25em;margin-left: 2em;list-style-type: none;">➥ <font color="ab5c5c">Exception</font> implements Throwable</li> - <li style="font-size: 1.25em;margin-left: 2em;list-style-type: none;">➥ <font color="ab5c5c">Error</font> implements Throwable</li> - <li style="font-size: 1em;margin-left: 4em;list-style-type: none;">➥ <font color="ab5c5c">TypeError</font> extends Error</li> - <li style="font-size: 1em;margin-left: 4em;list-style-type: none;">➥ <font color="ab5c5c">ParseError</font> extends Error</li> - </ul> - </section> -<section id="php7ret"> - <p class="p" style="font-size:1.1em;text-align:left;">Return Types</p> - <pre><code data-trim style="font-size:1.1em;" >function get_config(): array { - return 42; -} -get_config();</code></pre> - <pre><code class="shell nohighlight" data-trim style="font-size:0.9em;" >Fatal error: Uncaught TypeError: Return value of get_config() must be -of the type array, integer returned in file:2 -Stack trace: -#0 file(4): get_config() -#1 {main} - thrown in file on line 2</code></pre> - </section> -<section id="php7STH"> - <p class="p" style="font-size:1.1em;text-align:left;">Coercive Scalar Types</p> - <pre><code data-trim style="font-size:1.1em;" >function logmsg(string $msg, int $level, float $severity) { - var_dump($msg); // string(1) "1" - var_dump($level); // int(2) - var_dump($severity); // float(3) -} -logmsg(1, "2.5 bananas", 3);</code></pre> - <pre><code class="shell nohighlight" data-trim style="font-size:0.9em;" >Notice: A non well formed numeric value encountered in file on line 2</code></pre> - <p class="p" style="font-size:1.1em;text-align:left;">Strict Scalar Types</p> - <pre><code data-trim style="font-size:1.1em;" >declare(strict_types=1); -... -logmsg(1, "2.5", 3);</code></pre> - <pre><code class="shell nohighlight" data-trim style="font-size:0.9em;" >Fatal error: Uncaught TypeError: Argument 1 passed to logmsg() must be of the -type string, integer given, called in file on line 7 and defined in file:3 -Stack trace: -#0 file(7): logmsg(1, '2.5', 3) -#1 {main} - thrown in file on line 2</code></pre> - </section> -<section id="php7anon"> - <p class="p" style="font-size:1.1em;text-align:left;">Anonymous Classes</p> - <pre><code data-trim style="font-size:1.2em;" >return new class($controller) implements Page { - public function __construct($controller) { - /* ... */ - } - /* ... */ -}; - -class MyObject extends MyStuff { - public function getInterface() { - return new class implements MyInterface { - /* ... */ - }; - } -}</code></pre> - </section> -<section id="php7coalesce"> - <p class="p" style="font-size:1.1em;text-align:left;">Coalesce Operator</p> - <pre><code data-trim style="font-size:1.5em;" >$a = NULL; -$b = 0; -$c = 2; - -echo $a ?? $b; // 0 -echo $c ?? $b; // 2 -echo $a ?? $b ?? $c; // 0 -echo $a ?? $x ?? $c; // 2</code></pre> - </section> -<section id="Spaceship"> - <p class="p" style="font-size:1.1em;text-align:left;">Spaceship Operator</p> - <img src="/presentations/slides/intro/lego-php-astronaut.png" width="230" height="345"> - <pre><code data-trim style="font-size:1.1em;" >function cmp_php5($a, $b) { - return ($a < $b) ? -1 : (($a >$b) ? 1 : 0); -} - -function cmp_php7($a, $b) { - return $a <=> $b; -}</code></pre> - </section> -<section id="php7cleanups"> - <p class="p" style="font-size:1.1em;text-align:left;">Removal of many deprecated features<BR/> - (Your PHP4 code will break!)</p> - <pre><code data-trim >- ext/ereg (use ext/pcre instead) -- preg_replace() eval modifier (use preg_replace_callback() instead) -- ext/mysql (use ext/mysqli or ext/pdo_mysql instead) -- Assignment of new by reference -- Scoped calls of non-static methods from incompatible $this context - -- dl() in php-fpm -- set_magic_quotes_runtime() and magic_quotes_runtime() -- set_socket_blocking() (use stream_set_blocking() instead) -- mcrypt_generic_end() (use mcrypt_generic_deinit() instead) -- mcrypt_ecb, mcrypt_cbc, mcrypt_cfb and mcrypt_ofb - (use mcrypt_encrypt() and mcrypt_decrypt() instead) -- datefmt_set_timezone_id() and IntlDateFormatter::setTimeZoneID() - (use datefmt_set_timezone() or IntlDateFormatter::setTimeZone() instead) - -- xsl.security_prefs (use XsltProcessor::setSecurityPrefs() instead) -- iconv.input_encoding, iconv.output_encoding, iconv.internal_encoding, - mbstring.http_input, mbstring.http_output and mbstring.internal_encoding - (use php.input_encoding, php.internal_encoding and php.output_encoding instead) - -- $is_dst parameter of the mktime() and gmmktime() functions -- # style comments in ini files (use ; style comments instead) -- String category names in setlocale() (use LC_* constants instead) -- Unsafe curl file uploads (use CurlFile instead) -- PDO::PGSQL_ATTR_DISABLE_NATIVE_PREPARED_STATEMENT driver option - (use PDO::ATTR_EMULATE_PREPARES instead) -- CN_match and SNI_server_name stream context option (use peer_name instead)</code></pre> - </section> -<section id="php7reserved"> - <p class="p" style="font-size:1.1em;text-align:left;">New reserved words:</p> - <ul> - <li style="font-size: 1em;list-style-type: none;">bool</li> - <li style="font-size: 1em;list-style-type: none;">int</li> - <li style="font-size: 1em;list-style-type: none;">float</li> - <li style="font-size: 1em;list-style-type: none;">string</li> - <li style="font-size: 1em;list-style-type: none;">null</li> - <li style="font-size: 1em;list-style-type: none;">false</li> - <li style="font-size: 1em;list-style-type: none;">true</li> - <li style="font-size: 1em;list-style-type: none;">resource</li> - <li style="font-size: 1em;list-style-type: none;">object</li> - <li style="font-size: 1em;list-style-type: none;">mixed</li> - <li style="font-size: 1em;list-style-type: none;">numeric</li> - </ul> - </section> -<section id="php7num"> - <p class="p" style="font-size:1.1em;text-align:left;">64-bit integer support on Windows</p> - <p class="p" style="font-size:1.1em;text-align:left;">Cleanup edge-case integer overflow/underflow</p> - <p class="p" style="font-size:1.1em;text-align:left;">Support for strings with length >= 2^31 bytes in 64 bit builds.</p> - <p class="p" style="font-size:1.1em;text-align:left;">Parse error on invalid numeric literals</p> - <pre><code data-trim >$mask = 0855; // Parse error: Invalid numeric literal</code></pre> - </section> -<section id="php7UVS"> - <p class="p" style="font-size:1.1em;text-align:left;">Uniform variable syntax</p> - <pre><code data-trim >// left-to-right -$this->$belongs_to['column'] -// vs. -$this->{$belongs_to['column']} - -// support missing combinations of operations -$foo()['bar']() -[$obj1, $obj2][0]->prop -getStr(){0} - -// support nested :: -$foo['bar']::$baz -$foo::$bar::$baz -$foo->bar()::baz() - -// support nested () -foo()() -$foo->bar()() -Foo::bar()() -$foo()() - -// support operations on arbitrary (...) expressions -(...)['foo'] -(...)->foo -(...)->foo() -(...)::$foo -(...)::foo() -(...)() - -// two more practical examples for the last point -(function() { ... })() -($obj->closure)() - -// support all operations on dereferencable scalars -// (not very useful) -"string"->toLower() -[$obj, 'method']() -'Foo'::$bar</code></pre> - </section> -<section id="php7unicode"> - <p class="p" style="font-size:1.1em;text-align:left;">Unicode Codepoint Escape Syntax</p> - <pre><code data-trim style="font-size:1.2em;" >echo "\u{202E}Right-to-left text"; - -echo " \u{26BD}";</code></pre> - <pre class="output" style="font-size:1.2em;">Right-to-left text ⚽ </pre> <p class="p" style="font-size:1.1em;text-align:left;">ICU IntlChar class added to intl extension</p> - </section> -<section id="php7csprng"> - <p class="p" style="font-size:1.1em;text-align:left;">CSPRNG</p> - <pre><code data-trim style="font-size:1.2em;" >$int = random_int(-500, 500); -$bytes = random_bytes(10); - -var_dump( $int ); -var_dump( bin2hex($bytes) );</code></pre> - <pre class="output" style="font-size:1.2em;">int(98) -string(20) "1fe3d208d5e341b0acce" - </pre> </section> </section> - <section> <section id="php71"> <h1 style="text-align:center;">PHP 7.1</h1> </section> diff --git a/phpkonf.xml b/phpkonf.xml index d025528..8df3b66 100644 --- a/phpkonf.xml +++ b/phpkonf.xml @@ -39,7 +39,6 @@ <slide>slides/intro/php7prod.xml</slide> <slide>slides/intro/web_impact.xml</slide> -<slide>slides/intro/php7_2017.xml</slide> <slide>slides/intro/php71_2017.xml</slide> <slide>slides/intro/phan_2017.xml</slide> <slide>slides/intro/phan_ts.xml</slide>