0

Is static public vs public static the same in functionality? (I use PHP)

class Car{
    static public $break='strong break';
    public static $maxspeed=100;
}

Is it just for reading easier by using the first one?

hatted
  • 1,535
  • 1
  • 15
  • 26

2 Answers2

2

There is absolutely no difference between static public and public static. The order of the keywords doesn't matter in this situation, use whatever you think will be more easily read.

Michael Barz
  • 276
  • 2
  • 11
  • Neither is syntactically incorrect, however, 99% of the code out there uses `public static` vs the other way. And makes sense, you immediately see the scope of the member. – Mike Purcell Jul 10 '14 at 06:30
0

It just for a variable permission or define as variable behaviour, keyword 'public' and 'static' are allowed to used in different order, output will be the same.

Deeper
  • 129
  • 1
  • 13