svn: /phpdoc/en/trunk/language/oop5/ basic.xml

From: Date: Sun, 15 Aug 2010 07:29:10 +0000
Subject: svn: /phpdoc/en/trunk/language/oop5/ basic.xml
Groups: php.doc.cvs 
Request: Send a blank email to doc-cvs+get-6993@lists.php.net to get a copy of this message
degeberg Sun, 15 Aug 2010 07:29:10 +0000 Revision: http://svn.php.net/viewvc?view=revision&revision=302256 Log: Fixed PHP bug #52499 (new keyword not fully documented) Bug: http://bugs.php.net/52499 (Open) new keyword not fully documented Changed paths: U phpdoc/en/trunk/language/oop5/basic.xml Modified: phpdoc/en/trunk/language/oop5/basic.xml =================================================================== --- phpdoc/en/trunk/language/oop5/basic.xml 2010-08-15 07:17:24 UTC (rev 302255) +++ phpdoc/en/trunk/language/oop5/basic.xml 2010-08-15 07:29:10 UTC (rev 302256) @@ -177,6 +177,39 @@ ]]> </screen> </example> + <para> + PHP 5.3.0 introduced a couple of new ways to create instances of an + object: + </para> + <example> + <title>Creating new objects</title> + <programlisting role="php"> +<![CDATA[ +<?php +class Test +{ + public function getNew() + { + return new static; + } +} + +$obj1 = new Test(); +$obj2 = $obj1->getNew(); +$obj3 = new $obj2; + +var_dump($obj1 === $obj2, $obj2 === $obj3); +?> +]]> + </programlisting> + &example.outputs; + <screen> +<![CDATA[ +bool(false) +bool(false) +]]> + </screen> + </example> </sect2> <sect2 xml:id="language.oop5.basic.extends">

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