note 98601 deleted from language.variables.variable by danbrown
| From: | danbrown@php.net | Date: | Fri, 25 Jun 2010 17:44:55 +0000 |
| Subject: | note 98601 deleted from language.variables.variable by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-170464@lists.php.net to get a copy of this message | ||
Note Submitter: mason
----
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!'