What is the difference between public, private and protected in PHP?
Hi everyone! I just started learning object-oriented programming in PHP and I can't understand the difference between the access modifiers public, private and protected. I've read the documentation, but in practice I still get confused.\n\nHere's a simple class I have:\n\n```php\nclass Car {\n public $color = 'red';\n private $engineStatus = 'off';\n protected $fuelLevel = 100;\n \n public function startEngine() {\n $this->engineStatus = 'on';\n }\n \n private function checkFuel() {\n return $this->fuelLevel > 0;\n }\n \n protected function refuel($liters) {\n $this->fuelLevel += $liters;\n }\n}\n```\n\nI create an object:\n\n```php\n$car = new Car();\necho $car->color; // Works\necho $car->engineStatus; // Error!\n$car->refuel(20);