com presentations: tweaks: fluent15.html slides/intro/php7_ 2015.xml
[email protected] (Rasmus Lerdorf)
| Newsgroups | php.pres |
|---|---|
| Message-ID | <[email protected]> |
Commit: d202cb2a09fb39e026aa887fa6f92aa4eacab1c9 Author: Rasmus Lerdorf <[email protected]> Tue, 21 Apr 2015 10:00:20 -0700 Parents: 972dee5c277c0f7a4ccbb5ba56048479aee2c9da Branches: master Link: http://git.php.net/?p=presentations.git;a=commitdiff;h=d202cb2a09fb39e026aa887fa6f92aa4eacab1c9 Log: tweaks Changed paths: M fluent15.html M slides/intro/php7_2015.xml Diff: diff --git a/fluent15.html b/fluent15.html index 1ee4be7..374e28c 100644 --- a/fluent15.html +++ b/fluent15.html @@ -262,6 +262,26 @@ call_method(null); } // Exception: Call to a member function method() on a non-object</code></pre> </section> +<section id="php7closecall"> + <p class="p" style="font-size:1.1em;text-align:left;">✔ Added Closure::call()</p> + <pre><code data-trim style="font-size:1.1em;">$f = function () { + return $this->n; +}; +class MyClass { + private $n = 42; +} +$myC = new MyClass; +$c = $f->bindTo($myC, "MyClass"); +$c();</code></pre> + <pre><code data-trim style="font-size:1.1em;">$f = function () { + return $this->n; +}; +class MyClass { + private $n = 42; +} +$myC = new MyClass; +$f->call($myC);</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> @@ -293,18 +313,37 @@ call_method(null); (use PDO::ATTR_EMULATE_PREPARES instead) - CN_match and SNI_server_name stream context option (use peer_name instead)</code></pre> </section> -<section id="php7nonobject"> +<section id="php7reserved"> + <p class="p" style="font-size:1.1em;text-align:left;">✔ New reserved words:</p> + <ul> + <li style="font-size: 1em;">bool</li> + <li style="font-size: 1em;">int</li> + <li style="font-size: 1em;">float</li> + <li style="font-size: 1em;">string</li> + <li style="font-size: 1em;">null</li> + <li style="font-size: 1em;">false</li> + <li style="font-size: 1em;">true</li> + <li style="font-size: 1em;">resource</li> + <li style="font-size: 1em;">object</li> + <li style="font-size: 1em;">mixed</li> + <li style="font-size: 1em;">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;">✔ Catchable "call to member function of non-object"</p> - <pre><code data-trim>$this->getAction()->invoke(); -// PHP 5.5: Fatal error: Call to a member function invoke() on a non-object in file on line N -// PHP 5.6: Fatal error: Call to a member function invoke() on null in file on line N -// PHP 7.0: Catchable fatal error: Call to a member function invoke() on null in file on line N</code></pre> + <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>// support missing combinations of operations + <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} diff --git a/slides/intro/php7_2015.xml b/slides/intro/php7_2015.xml index fe9813e..078a258 100644 --- a/slides/intro/php7_2015.xml +++ b/slides/intro/php7_2015.xml @@ -96,6 +96,33 @@ try { // Exception: Call to a member function method() on a non-object ]]></example> +<break lines="1" section="php7closecall"/> +<blurb fontsize="1.1em" align="left">✔ Added Closure::call()</blurb> +<example fontsize="1.1em" result='0' title=""><![CDATA[ +<?php +$f = function () { + return $this->n; +}; +class MyClass { + private $n = 42; +} +$myC = new MyClass; +$c = $f->bindTo($myC, "MyClass"); +$c(); +]]></example> + +<example fontsize="1.1em" result='0' title=""><![CDATA[ +<?php +$f = function () { + return $this->n; +}; +class MyClass { + private $n = 42; +} +$myC = new MyClass; +$f->call($myC); +]]></example> + <break lines="1" section="php7cleanups"/> <blurb fontsize="1.1em" align="left">✔ Removal of many deprecated featuresBR/ (Your PHP4 code will break!)</blurb> @@ -130,18 +157,31 @@ try { ]]></example> -<break lines="1" section="php7nonobject"/> +<break lines="1" section="php7reserved"/> +<blurb fontsize="1.1em" align="left">✔ New reserved words:</blurb> +<list> +<bullet fontsize="1em" type="none">bool</bullet> +<bullet fontsize="1em" type="none">int</bullet> +<bullet fontsize="1em" type="none">float</bullet> +<bullet fontsize="1em" type="none">string</bullet> +<bullet fontsize="1em" type="none">null</bullet> +<bullet fontsize="1em" type="none">false</bullet> +<bullet fontsize="1em" type="none">true</bullet> +<bullet fontsize="1em" type="none">resource</bullet> +<bullet fontsize="1em" type="none">object</bullet> +<bullet fontsize="1em" type="none">mixed</bullet> +<bullet fontsize="1em" type="none">numeric</bullet> +</list> -<blurb fontsize="1.1em" align="left">✔ 64-bit integer support on Windows</blurb> +<break lines="1" section="php7num"/> +<blurb fontsize="1.1em" align="left">✔ 64-bit integer support on Windows</blurb> <blurb fontsize="1.1em" align="left">✔ Cleanup edge-case integer overflow/underflow</blurb> - -<blurb fontsize="1.1em" align="left">✔ Catchable "call to member function of non-object"</blurb> +<blurb fontsize="1.1em" align="left">✔ Support for strings with length >= 2^31 bytes in 64 bit builds.</blurb> +<blurb fontsize="1.1em" align="left">✔ Parse error on invalid numeric literals</blurb> <example result='0' title=""><![CDATA[ -$this->getAction()->invoke(); -// PHP 5.5: Fatal error: Call to a member function invoke() on a non-object in file on line N -// PHP 5.6: Fatal error: Call to a member function invoke() on null in file on line N -// PHP 7.0: Catchable fatal error: Call to a member function invoke() on null in file on line N +<?php +$mask = 0855; // Parse error: Invalid numeric literal ]]></example> <break lines="1" section="php7UVS"/> @@ -150,6 +190,11 @@ $this->getAction()->invoke(); <example result='0' title=""><![CDATA[ <?php +// left-to-right +$this->$belongs_to['column'] +// vs. +$this->{$belongs_to['column']} + // support missing combinations of operations $foo()['bar']() [$obj1, $obj2][0]->prop