PHP·98 questions

What are access modifiers?

Answer
public — accessible everywhere.
protected — class and subclasses.
private — only within the class.
PHP 8.1+: readonly properties.
Default is public.
Was this answer helpful?

More questions in this topic

Related questions from other topics