note 68482 deleted from language.variables.variable by danbrown
| From: | danbrown@php.net | Date: | Wed, 24 Jun 2009 16:52:54 +0000 |
| Subject: | note 68482 deleted from language.variables.variable by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-157394@lists.php.net to get a copy of this message | ||
Note Submitter: work_at_inarad.ro
----
This is how to declare a class from a string that contain the classname.
class m{
function m($msg="I am the class
m<br>"){
echo $msg;
}
}
function message(){
return "Class declared with this string!<br>";
}
$classCall="m"; //this variable will contain the class name
$n=new $classCall; //initiate class
$k=new $classCall(message()); //initiate class with parameters