Why do we define getter and setter functions for private variables in PHP instead of defining them public?

Started by Karol, November 17, 2016, 07:04:54 PM

Previous topic - Next topic

Flynn

Hi everyone, I'd like to ask you a little bit of a special question, why do we define getter and setter functions for private variables in php instead of defining them public? Please inform me as soon as possible.