Could someone provide me with some code to hold an object reference in
a static variable in a function.
function a(&$t){
static $b;
if(is_object($b )){
print "IN - $b->logfile";
} else {
print "Setting<BR >";
$b = &$t;
print "IN - $b->logfile<BR>" ;
}
}
calling a with a object reference then should hold its reference and
if called with no args it should print out the references variable.
But when called with no aguments the static varible b is null. Can
some one help be out here. Thanks
$text->logfile = "TEST";
a(&$test);
a();
output
------
Setting
IN - TEST
Setting
IN - TEST
a static variable in a function.
function a(&$t){
static $b;
if(is_object($b )){
print "IN - $b->logfile";
} else {
print "Setting<BR >";
$b = &$t;
print "IN - $b->logfile<BR>" ;
}
}
calling a with a object reference then should hold its reference and
if called with no args it should print out the references variable.
But when called with no aguments the static varible b is null. Can
some one help be out here. Thanks
$text->logfile = "TEST";
a(&$test);
a();
output
------
Setting
IN - TEST
Setting
IN - TEST
Comment