note 98601 added to language.variables.variable

From: Date: Fri, 25 Jun 2010 17:43:47 +0000
Subject: note 98601 added to language.variables.variable
Groups: php.notes 
Request: Send a blank email to php-notes+get-170463@lists.php.net to get a copy of this message
I don't know why this isn't documented here already, but PHP actually supports variable class names. This can be incredibly useful in writing at a more abstract level. <?php class Foo { public function hello() { echo 'Hello world!'; } } $my_foo = 'Foo'; $a = new $my_foo(); $a->hello(); //prints 'Hello world!' ---- Server IP: 192.41.42.26 Probable Submitter: 208.65.181.179 ---- Manual Page -- http://www.php.net/manual/en/language.variables.variable.php Edit -- https://master.php.net/note/edit/98601 Del: integrated -- https://master.php.net/note/delete/98601/integrated Del: useless -- https://master.php.net/note/delete/98601/useless Del: bad code -- https://master.php.net/note/delete/98601/bad+code Del: spam -- https://master.php.net/note/delete/98601/spam Del: non-english -- https://master.php.net/note/delete/98601/non-english Del: in docs -- https://master.php.net/note/delete/98601/in+docs Del: other reasons-- https://master.php.net/note/delete/98601 Reject -- https://master.php.net/note/reject/98601 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#170463) next »