Posted by Carramba on 01/04/06 01:38
hello!
Iam wondering how can I include file in class? is it possible?
is it possible to create object inside another object? for instance if I
create mysqli connection object inside another class is that doible? or
one should pass created objekt as parameter to another objekt?
regarding include it works if I do like this
PHP Code:
class myClass{
function(){
include 'func.php';
func(); //returns $var
//do something with $var
return $array;
}
function1(){
include 'func.php';
func();//returns $var
//do something with $var
return $array2;
}
}
but it doesn't make eny sence to include it over and over again in every
function so I would like to that get some thing like
PHP Code:
class myClass{
include 'func.php'; //but this don't work
func(); // $var=3
function(){
//do something with $var
return $array;
}
function(){
//do something with $var
return $array2;
}
any ideas or comments?
thanx in advance
[Back to original message]
|