Sr. PHP Programmer Question:
Download Questions PDF

In a PHP class what are the three visibility keywords of a property or method?

Answer:

public, private and protected. The default is public.
Public -> Any class may instantiate the class and call the method or property.
Protected -> Only the class itself or inherited (children) classes may call a method or property.
Private -> Only the class itself may call a method or property.

Download Senior PHP Programmer Interview Questions And Answers PDF

Previous QuestionNext Question
How will you access the error code associated with file upload in PHP?What are the 3 scope levels available in PHP and how would you define them?