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.

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.