Single Choice Not Set

Q Which of the following is/are the right way to declare a method?
(i) function functionName() { function body }
(ii) scope function functionName() { function body }
(iii) method methodName() { method body }
(iv) scope method methodName() { method body }

ID: #2577 Object Oriented Concept of PHP 1,073 views
Question Info
#2577Q ID
Not SetDifficulty
Object Oriented Concept of PHPTopic

Choose the Best Option

Click any option to instantly check if you're correct.

  • A Only (ii)
  • B Only (iv)
  • C (i) and (ii)
  • D (iii) and (iv)
Correct Answer

Explanation

In case of public methods, you can forgo explicitly declaring the scope and just declare the method like you would a function.

Share This Question

Challenge a friend or share with your study group.