Let's say you have an abstract class:
abstract class PersonAbstract
private $name = "Stack Overflow";
Is it legal so declare an attribute as private within an abstract class? Or the fact that this class should be extended, the minimum visibility is protected?
Best How To :
Yes, you can have a private field within an abstract class. This field will only be accessible to functions within that abstract class though. Any classes which inherit from your abstract class will not be able to access the field.
You can declare both fields and functions as public, protected or private within an abstract class. If a field or function is public, it is accessible to anyone. If it is protected, it is accessible only to that class, and any classes which inherit from that class. If it is private, it is only accessible to that class.
Abstract functions must be implemented by an inheriting class, so it makes no sense (and probably won't work) to have a private abstract function.