Which one of the following is the right way of defining a function in PHP?
Correct answer
D. function fumctionName(parameters) { function body }
12 views
D. function fumctionName(parameters) { function body }
12 views
A PHP function is declared with the function keyword, followed by the function name, a parameter list in parentheses and the body in curly braces: function functionName(parameters) { ... }.
Unlike C or Java, PHP does not put a return data type before the function name, and the function keyword cannot be omitted, which rules out the other options.
Keep preparing with more Computer Science MCQs on MCQsExam.com.
Not sure why the answer is D? Ask here and get an explanation.