Which keyword precedes a method name?
Correct answer
B. function
14 views
B. function
14 views
In PHP a method is declared with the function keyword placed immediately before the method name, for example public function getPrice().
Visibility keywords such as public or protected may come earlier in the declaration, but it is function that directly precedes the name. There is no method keyword in PHP.
Practise more Computer Science MCQs with answers and explanations on MCQsExam.com.
Not sure why the answer is B? Ask here and get an explanation.