Anonymous classes are useful for simple one-off objects. With anonymous classes you can define a class and instantiate an object inline.
<?php /** Anonymous classes */ $anonymousClassObject = new class { public function test() { return "PHPCodez"; } }; echo $anonymousClassObject->test();