I recently found an interesting use of code, and I did not know that this was possible. Can someone explain or give me a help page explaining why the code below works? I understand what ::can be used to reflect parent, static, etc. Or for accessing static fields / methods, but with a link $thisseems weird mostly because the method is a()not static
class Test
{
private function a()
{
echo 'a works';
}
public static function c()
{
echo 'c works';
}
public function b()
{
$this::a();
$this::c();
$this->a();
self::a();
static::a();
Test::c();
}
}
(new Test)->b();
I tried to find some information myself, but no luck.
Edit:
I know that ::I also know that it will give a warning if E_STRICT is enabled.
source
share