I was just wondering if I have a class, and i globalize it, can it still work as if it werent globalized?
For instance:
<?php
class name
{
function method()
{
return 5;
}
}
$class = new name;
global $class;
function func()
{
return $GLOBALS['class']->method();
}
?>
Would the above code work as expected?
My next question is how efficient is this? Someone told me I would be better off including the class within each function as a parameter, and assigning it to a class variable within a class.
I want something thats alittle easier, but efficient, and won't cause any problems.