PHP Community Marketing Expert Question:
Download Questions PDF

Explain me what are the 3 scope levels available in PHP and how would you define them?


Private – Visible only in its own class
Public – Visible to any other code accessing the class
Protected – Visible only to classes parent(s) and classes that extend the current class

This is important for any developer to know because it shows an understanding that building applications is more than just being able to write code. One must also have an understanding about privileges and accessibility of that code. There are times protected variables or methods are extremely important, and an understanding of scope is needed to protect the integrity of the data in your application along with provide a clear path through the code.

Download PHP Community Marketing Expert Interview Questions And Answers PDF

Previous QuestionNext Question
Explain how we can get the number of elements in an array?Tell me what does the following code output?

$i = 016;
echo $i / 2;?