Greetings, colleagues.

Actually, it is interesting, what is the fundamental difference between declaring a method in a class ... Apart from the generally accepted standards, is there a difference in the use of these two class methods?

class A { public static function MethodOne() { //return; } static public function MethodTwo() { //return; } } 

Thank!

  • 2
    Well, in one case you have a public static method, and in the other a static public method ... joke, I think there is no difference, but it’s correct to write public static - tCode
  • irrelevant, ambivalent, one-dimensional - rjhdby
  • 3
    Googled a lot of things, and I can answer my own question. According to the PSR-2 standard, static should be declared after the public scope modifier is declared :) - Andrew Koshkin
  • one
    @AndrewKoshkin then write your answer. And then I went with a link to the PSR, and here everything is already known :) - ilyaplot

1 answer 1

Correct answer:

According to PSR-2 regulations

Must be declared on all properties and methods; abstract and final MUST be declared before the visibility; static MUST be declared after the visibility .

Therefore, static public and public static are identical, but the correct solution according to the standards for writing code is public static