PHP 7 Anonymous Classes

Anonymous Classes is added in PHP 7.Anonymous classes are defined without any name.we can define an anonymous class using keyword "new class". Anonymous classes can be nested, i.e. defined inside other classes.

<?php

// Pre PHP 7 code
class Buuny
{
    public function log($message)
    {
        echo $message ;
    }
}

$util->setBuuny(new Buuny());

// PHP 7+ code
$util->setBuuny(new class {
    public function log($message)
    {
        echo $message;
    }
});
?>