Using the :: operator on an object

Viewed 105

Recently I've found interesting usage of code and I didn't know that it's possible. Can someone explain or give me manual page with explanation why the code below works? I understand :: can be used to reflect methods from parent, static etc. or to access static fields/methods but with reference $this it seems weird mostly because method a() is not static

class Test
{
   private function a()
   {
      echo 'a works';
   }

   public static function c()
   {
      echo 'c works';
   }

   public function b()
   {
        $this::a(); // this is weird
        $this::c(); // also this
        $this->a(); // normal usage
        self::a();  // as expected
        static::a(); // same as above
        Test::c();  // as expected
   }
}


(new Test)->b();

I've tried to find some information on my own but with no luck.

Edit:

I'm aware what :: is also I know it will throw warning if E_STRICT is enabled.

1 Answers
Related