how i can detect direct access to a method ?

hi

for example :


class A extends ActiveRecord{

   public function getTest(){

     if(direct access)

       return 'a';

     else

       return 'b';

   }

}


$obj = new A

echo $obj->test; // b

echo $obj->getTest(); //a



You can’t.

Well, you can but you’ll need to override __set and __get of the class.