What is meant by public, private, protected, static and final scopes?



What is meant by public, private, protected, static and final scopes?..

Answer / Mohammad Jafar

In PHP, classes can have properties and methods with different access levels. Public properties/methods can be accessed from anywhere. Private properties/methods can only be accessed within the class. Protected properties/methods can be accessed within the class and its child classes. Static properties/methods are shared among all instances of a class. Final means that a property or method cannot be overridden in a child class.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More PHP Interview Questions

Which library is used in php to do various types of image work?

1 Answers  


What is a null coalescing operator in php7?

1 Answers  


how many types of inheritance is there in php? name there?

10 Answers  


What is uri routing?

1 Answers  


Make a "dynamic drop down list" with using only PHP,HTML and MySQL..

2 Answers  


Binary tree question - Node has numeric data (int) The function takes depth as argument and sum all the value of the node of the depth. For instance, (0) depth 0 / \ 10 20 depth 1 / \ / \ 40 50 60 70 depth 2 so if you pass get_sum(2), you would return 220 which is 40+50+60+70 (sum of depth2) write the function.

1 Answers   Amazon, FGD,


Tell me how can I display text with a php script?

1 Answers  


Why php is also called as scripting language?

1 Answers  


What is api laravel?

1 Answers  


What is the role of the .htaccess file in php?

1 Answers  


Write a program to get second highest number in an array using php?

1 Answers  


when will be syndicate bank written exam ? i need the date of exam

0 Answers  


Categories