public static or static public

Date: 28 Feb 2010 Comments: 0

Recently, I learned that in PHP and C# declarations like static public or static private are absolutely valid declarations of static methods.

You can use both declarations, they has same meaning and there is no recommendation which one should be used:

public static function myStaticMethod()

or

static public function myStaticMethod()

But in my practice I didn’t see static public declaration. Also, I simple research shows that most of the programmers prefer to put the visibility first. It is better because shows which method can be used. It seems that the better programming practice is to declare public static.

Leave a Reply


Spam protection by WP Captcha-Free