[eluser]Loic Sharma[/eluser]
Hello, I'm a pretty new PHP 'developer', and I have a quick question about static and 'instanced' (that is, $foo->bar(); - I'm not sure how it is truly called) OOP. Quite simply, I sincerely do not get why 'instanced' OOP is used over static OOP so much.
To me, it seems as if static OOP provides much much more flexibility and ease than 'instanced' php. For example (unless you're using CI, of course
), to get access to a class within another class, you always have to do:
Code:
global $foo;
$foo->bar();
Whereas static allows you to just do:
Is the reason why 'instanced' OOP is used over static because it is faster, or stabler? Or is there another reason?
Thanks for reading this, and thank you if you reply. It'll greatly help me learn