note 68482 added to language.variables.variable
| From: | work_at_inarad dot ro at osu1 dot php dot net | Date: | Fri, 28 Jul 2006 23:49:06 +0000 |
| Subject: | note 68482 added to language.variables.variable | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-115308@lists.php.net to get a copy of this message | ||
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
----
Server IP: 216.235.15.211
Probable Submitter: 82.79.28.160
----
X-Spam-Status: No, hits=3.3 required=5.0 tests=DATE_MISSING,FROM_NO_LOWER,
HTML_MESSAGE autolearn=no version=2.64
----
Manual Page -- http://www.php.net/manual/en/language.variables.variable.php
Edit -- http://master.php.net/note/edit/68482
Del: integrated -- http://master.php.net/note/delete/68482/integrated
Del: useless -- http://master.php.net/note/delete/68482/useless
Del: bad code -- http://master.php.net/note/delete/68482/bad+code
Del: spam -- http://master.php.net/note/delete/68482/spam
Del: non-english -- http://master.php.net/note/delete/68482/non-english
Del: in docs -- http://master.php.net/note/delete/68482/in+docs
Del: other reasons-- http://master.php.net/note/delete/68482
Reject -- http://master.php.net/note/reject/68482
Search -- http://master.php.net/manage/user-notes.php