PHP public Keyword

PHP Keywords : Use public to declare a property that can be modified by any code

Definition and Usage

The public keyword is an access modifier. It marks a property or method as public.

Public properties and methods can be used by any code that can access the object.

Related Pages

The protected keyword

The private keyword

Learn more about access modifiers in our PHP OOP - Access Modifiers Tutorial.

❮ PHP Keywords