PHP·98 questions

What are anonymous classes?

Answer
$obj = new class { }.
PHP 7.0+.
For one-time implementations.
Can inherit and implement interfaces.
Used in tests, mocks.
Was this answer helpful?

More questions in this topic

Related questions from other topics