Comments on: PHP4 Static Function Calls http://www.terminally-incoherent.com/blog/2006/10/03/php4-static-function-calls/ I will not fix your computer. Tue, 04 Aug 2020 22:34:33 +0000 hourly 1 https://wordpress.org/?v=4.7.26 By: Cristian http://www.terminally-incoherent.com/blog/2006/10/03/php4-static-function-calls/#comment-13930 Tue, 05 Jan 2010 13:44:26 +0000 http://www.terminally-incoherent.com/blog/2006/10/03/php4-static-function-calls/#comment-13930

POO on PHP4 sucks… I rather prefer PHP5, it still sucks but not too much.

Bye… thanks for the info.

Reply  |  Quote
]]>
By: kakashi http://www.terminally-incoherent.com/blog/2006/10/03/php4-static-function-calls/#comment-12568 Mon, 15 Jun 2009 09:40:09 +0000 http://www.terminally-incoherent.com/blog/2006/10/03/php4-static-function-calls/#comment-12568

haha very good test

Reply  |  Quote
]]>
By: Luke Maciak http://www.terminally-incoherent.com/blog/2006/10/03/php4-static-function-calls/#comment-8800 Thu, 17 Apr 2008 14:06:26 +0000 http://www.terminally-incoherent.com/blog/2006/10/03/php4-static-function-calls/#comment-8800

Oh wait… PHP4 doesn’t have exceptions! Damn! :(

LOL

Reply  |  Quote
]]>
By: Luke Maciak http://www.terminally-incoherent.com/blog/2006/10/03/php4-static-function-calls/#comment-8798 Thu, 17 Apr 2008 13:58:44 +0000 http://www.terminally-incoherent.com/blog/2006/10/03/php4-static-function-calls/#comment-8798

Nice! Or, maybe more elegantly:

if(is_null($this)) throw new Exception('Instance method cannot be called statically.');

This way gracefully handle errors caused by calling this method statically.

I’m stealing the idea. :)

Reply  |  Quote
]]>
By: Gemma Peter http://www.terminally-incoherent.com/blog/2006/10/03/php4-static-function-calls/#comment-8797 Thu, 17 Apr 2008 13:42:22 +0000 http://www.terminally-incoherent.com/blog/2006/10/03/php4-static-function-calls/#comment-8797

I ended up putting this line at the top of any instance methods to emulate the PHP5 differentiation between static and instance methods.

if(is_null($this)) {die(‘instance method cannot be called statically’);}

Reply  |  Quote
]]>