Hallo!

Can I from inside an Class Intialize other classes, and access them from the
ordinary script?

Page1.php
<?PHP
require_once("./myclass.inc");
$my = new MyClass;
$my->init();
$fileread->readfile($file="myfile.txt");
?>

myclass.inc
<?PHP
class MyClass
{
    var classes = Array(
                                    "classname1"=>"classkey1",
                                    "classname2"=>"classkey2",
                                    "classname3"=>"classkey3"
                            );

    function init()
    {
        foreach ($this->classes as $classname=>$classkey){
            require_once("./$classname.inc");
            eval("\$$classkey = new $classname;");
        }
    }

}
?>

David



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



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

Reply via email to