Andrew Fletcher published: 3 August 2022 1 minute read
Explain public, private, protected functions and variables inside a class in PHP.
I'll define a variable as a property
| public | method or property this is the default and can be accessed anywhere |
| protected | method or property that can be accessed by the class that declared it or that inherits the class |
| private | method or property that can only be accessed by the class that declared it |