How to access a private property in PHP

This is a basic PHP program based on object oriented programming which explain how to use the private access modifier in PHP with an example and output.

The private modifier is called with the private keyword before defined class name. After this tutorial, your basic concept of Object oriented programming will be clear.

How to access a private property in PHP

Program Output

The car model is Mercedes benz.

Liked this program? Do Like & share with your friends.

If you like FreeWebMentor and you would like to contribute, you can write an article and mail your article to [email protected] Your article will appear on the FreeWebMentor main page and help other developers.

Recommended Posts:


Prem Tiwari

An engineer by profession and a passionate blogger by heart. Founder of FreeWebMentor.com (A Programming blog for beginners), Tech Speaker at various forums. A part from this he is an open source enthusiast, WordPress Lover, Blogger, SEO, and Growth Strategic.

Comments and Discussions

Your email address will not be published. Required fields are marked *