svn: /phpdoc/en/trunk/language/ functions.xml

From: Date: Sun, 24 Jul 2016 11:23:00 +0000
Subject: svn: /phpdoc/en/trunk/language/ functions.xml
Groups: php.doc.cvs 
Request: Send a blank email to doc-cvs+get-14355@lists.php.net to get a copy of this message
cmb Sun, 24 Jul 2016 11:23:00 +0000 Revision: http://svn.php.net/viewvc?view=revision&revision=339708 Log: Fix #72662: Anonymous function example 5 relies on PHP 7 syntax Bug: https://bugs.php.net/72662 (Open) Anonymous function example 5 relies on PHP 7 syntax Changed paths: U phpdoc/en/trunk/language/functions.xml Modified: phpdoc/en/trunk/language/functions.xml =================================================================== --- phpdoc/en/trunk/language/functions.xml 2016-07-23 18:58:45 UTC (rev 339707) +++ phpdoc/en/trunk/language/functions.xml 2016-07-24 11:23:00 UTC (rev 339708) @@ -1515,13 +1515,15 @@ { public function testing() { - (function() { + return function() { var_dump($this); - })(); + }; } } -(new Test)->testing(); // as of PHP 5.4 +$object = new Test; +$function = $object->testing(); +$function(); ?> ]]> @@ -1533,10 +1535,16 @@ } ]]> </screen> + &example.outputs.53; + <screen> +<![CDATA[ +Notice: Undefined variable: this in script.php on line 8 +NULL]]> + </screen> </example> <para> - When declared in the context of a class, the current class is + As of PHP 5.4.0, when declared in the context of a class, the current class is automatically bound to it, making <literal>$this</literal> available inside of the function's scope. If this automatic binding of the current class is not wanted, then

« previous php.doc.cvs (#14355) next »