note 99638 added to keyword.class

From: Date: Fri, 27 Aug 2010 17:28:37 +0000
Subject: note 99638 added to keyword.class
Groups: php.notes 
Request: Send a blank email to php-notes+get-172117@lists.php.net to get a copy of this message
You can also instantiate objects using variables containing the name of the class: <?php $type = 'Foo'; $foo = new $type(); print_r( $foo ); /* Prints: Foo Object ( ) */ ?> The following works as well: <?php $somefoo = new Foo(); $anotherfoo = new $somefoo(); # so you don't have to do: $anotherfoo = new get_class( $somefoo)(); ?> ---- Server IP: 69.147.83.197 Probable Submitter: 145.53.45.17 ---- Manual Page -- http://www.php.net/manual/en/keyword.class.php Edit -- https://master.php.net/note/edit/99638 Del: integrated -- https://master.php.net/note/delete/99638/integrated Del: useless -- https://master.php.net/note/delete/99638/useless Del: bad code -- https://master.php.net/note/delete/99638/bad+code Del: spam -- https://master.php.net/note/delete/99638/spam Del: non-english -- https://master.php.net/note/delete/99638/non-english Del: in docs -- https://master.php.net/note/delete/99638/in+docs Del: other reasons-- https://master.php.net/note/delete/99638 Reject -- https://master.php.net/note/reject/99638 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#172117) next »