Thursday, September 29

php method access

In PHP, it doesn’t seem to matter what order the static and private / protected / public come in before a static method declaration. Here’s an example:

<?php
class whatever {
  public static function foo () { echo "foo called\n"; }
  static public function bar () { echo "bar called\n"; }
}
whatever::foo();
whatever::bar();

And on running:

brennen@exuberance 12:02:54 /home/brennen ★ php test.php
foo called
bar called

Did I know this once and forget it? In a decade+ of writing the stuff, did I somehow just never notice?