Public access modifier in PHP programming language

Prem Tiwari - - PHP Tutorials

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

The public modifier is called with the Public keyword before the defined class name. If you have added the public before any class, then that class will be accessible from outside of class.

After this tutorial, your basic concept of Object-oriented programming will be clear.

Public access modifier in PHP programming language

Program Output

The car model is Mercedes.

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.