So I have something like this:
class SomeClass{
//do some stuff
}
$variable = new SomeClass();
Now that in a php file called SomeClass.php for example, I want to in some other class called OtherClass.php do something like:
class OtherClass{
function doSomething(){
$variable->call_some_method();
}
}
How would I achieve this? I have thought of global variables, but then I see frameworks like Zend doing stuff like: $this->view->what_i_want_to_pass_to_the_view = 'hello apple sauce';
So what's a good way to do, essentially what I want to do.
Note: Some people are assuming I want to do global variables, this is not true. I am trying to replicate how Zend does something like $this->view in a class to send something to the view and then in the view, calls $this->view to get what was sent. I assumed this was done through globals...