note 69834 added to language.oop5.paamayim-nekudotayim

From: Date: Fri, 22 Sep 2006 14:40:18 +0000
Subject: note 69834 added to language.oop5.paamayim-nekudotayim
Groups: php.notes 
Request: Send a blank email to php-notes+get-117429@lists.php.net to get a copy of this message
`self'' and parent'' are valid arguments to the `new'' operator. All the constructor stuff works as expected. Example: <?php class Foo {} class Bar extends Foo { static function test() { return( array( new self, new self(), new parent( 'a', 1 ), ) ); } } print_r( Bar::test() ); ?> Calling Bar::test() gives you nice list of three instances. ( i'm describing it there, as it was a suprise to me. ) Maybe you can find it usefull, for example, in some generic ::__clone() method that works across inheritance tree. ---- Server IP: 83.64.128.68 Probable Submitter: 81.219.32.9 ---- Manual Page -- http://www.php.net/manual/en/language.oop5.paamayim-nekudotayim.php Edit -- https://master.php.net/note/edit/69834 Del: integrated -- https://master.php.net/note/delete/69834/integrated Del: useless -- https://master.php.net/note/delete/69834/useless Del: bad code -- https://master.php.net/note/delete/69834/bad+code Del: spam -- https://master.php.net/note/delete/69834/spam Del: non-english -- https://master.php.net/note/delete/69834/non-english Del: in docs -- https://master.php.net/note/delete/69834/in+docs Del: other reasons-- https://master.php.net/note/delete/69834 Reject -- https://master.php.net/note/reject/69834 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#117429) next »