Hi
I was just wondeirng how they work now, esspically regarding functions and
return values.
Do functions pass return by value or reference?
Concidering the following:
public static function &getInstane( ) {
static $database_objec t; // reference object
if (!is_object($da tabase))
$database_objec t = new database(); // create new object
return $database_objec t; // return address of object
}
Do I need to return $database_objec t; or return &$database_obje ct;
or
When calling the function:
$test = &database::getI nstane()
or
$test = database::getIn stane()
Thanks
I was just wondeirng how they work now, esspically regarding functions and
return values.
Do functions pass return by value or reference?
Concidering the following:
public static function &getInstane( ) {
static $database_objec t; // reference object
if (!is_object($da tabase))
$database_objec t = new database(); // create new object
return $database_objec t; // return address of object
}
Do I need to return $database_objec t; or return &$database_obje ct;
or
When calling the function:
$test = &database::getI nstane()
or
$test = database::getIn stane()
Thanks
Comment