Re: Static vs. Instantiated Objects in PHP

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



What?!? Why the need to make faces? Seems like a legitimate question to ask what goes on behind the scenes when you program a certain way.

Here's the rub, if static objects are treated the way they probably should be (as a function pointer), then why bother using object oriented syntax? You won't be able to inherit, override, or encapsulate much from a class where all members are static. All typical reasons to go OO. Plus you're just wrapping more syntax around what PHP does naturally which seems like something you probably wouldn't want to do.

However, if support for static objects isn't doing what would probably make sense, and it performs an object instantiation behind the scenes each time to call your static method, then that might be a reason not to use it (why do something ten times if you can do it once).

The question was posed for someone who might know the internals of PHP5 a lot better than myself, so sorry if this is the wrong list to ask, but Zend Internals didn't seem right either as it's not quite a development question.




On Apr 20, 2006, at 4:11 PM, Richard Lynch wrote:

On Thu, April 20, 2006 1:25 pm, Mark Baldwin wrote:
Does anyone know how static objects work behind the scenes in PHP5?
More specifically, is there a benefit to declaring an object and its
methods as static vs the more traditional OO way of instantiating an
object and then calling methods through the -> operator?

Didja try it?... o.O

--
Like Music?
http://l-i-e.com/artists.htm



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux