不寻常的OO行为?

here is some php code:

class A {
  private function action(){
    echo 1;
  }
  public static function callAction(A $a){
    $a->action();
  }
}

$a = new A;
A::callAction($a);

can someone explain me why does object method is vissible from static method context how does following code works in other languages ???

The keyword private means the function is accessible from within this class only, not from within this object. The behaviour is the same in all languages I know.

As your $a object is passed as a parameter in A::callAction(), you can call any of its methods, static or not.

And as in A::callAction(A) you are in the implementation of A class, you can call $a->action.

Simple ? =)