List Info

Thread: note 68482 added to language.variables.variable




note 68482 added to language.variables.variable
user name
2006-07-28 23:49:06
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.vari
able.php
Edit        -- http://master.p
hp.net/note/edit/68482
Del: integrated  -- ht
tp://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://m
aster.php.net/note/delete/68482/spam
Del: non-english -- h
ttp://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://ma
ster.php.net/manage/user-notes.php

-- 
PHP Notes Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub
.php

[1]

about | contact  Other archives ( Real Estate discussion Medical topics )