In this lesson, you will learn what anonymous classes are in PHP, how to create & use them. Anonymous classes like anonymous functions are nameless. You are able to create one-off objects using anonymous classes. You can either assign an anonymous class to a variable that will simply give you the object of that anonymous class, or just pass it as an argument since it's just an expression.
Note that at 4:54 I copied constructor promoted properties & pasted them into the anonymous class. Promoted properties should not be used inside an anonymous class when you are extending from a base class since those already exist on the base class.
SOME OF THE WAYS YOU CAN SUPPORT THE CHANNEL
👍 Smash the like button
🤝 Subscribe to the channel & turn the notifications on
💬 Post comments, any feedback is greatly appreciated
⭐ Become a Patreon: / programwithgio
THANK YOU!
LESSON 2.15
Course Outline - https://github.com/ggelashvili/learnp...
Course Playlist - • Learn PHP The Right Way - Full PHP Tutoria...
RESOURCES
Anonymous Classes RFC - https://wiki.php.net/rfc/anonymous_cl...
In questa pagina del sito puoi guardare il video online PHP Anonymous Classes - Full PHP 8 Tutorial della durata di ore minuti seconda in buona qualità , che l'utente ha caricato Program With Gio 14 maggio 2021, condividi il link con amici e conoscenti, su youtube questo video è già stato visto 20,344 volte e gli è piaciuto 1 mille spettatori. Buona visione!