DEV Community

Cover image for Constructor Property Promotion in PHP 8
Pierre-Henry Soria ✨
Pierre-Henry Soria ✨

Posted on • Edited on

Constructor Property Promotion in PHP 8

👉 In today's PHP workshop, we will see why the promoted constructor property is game-changing in PHP 8!

Adding the access modifier (public, protected, private) before the property name will tell PHP to treat the constructor arguments as "property promotions".

Happy coding! 🤠 I'm sure you will love using this feature in your next PHP 8+ project 🎉

👉 If you wish to go further, my Udemy course teaching how to build a complete PHP 8 application from scratch is now available: https://www.udemy.com/course/create-real-world-php-webapp-from-scratch/

Top comments (1)

Collapse
 
pierre profile image
Pierre-Henry Soria ✨

And you? 🤔 What's your opinion?