Home »
MCQs »
PHP MCQs
Which is the correct syntax of defining function return type in PHP?
105. Which is the correct syntax of defining function return type in PHP?
- function function_name(type $arguments) : return_type { /* function body*/ }
- function function_name(type $arguments) , return_type { /* function body*/ }
- return_type function function_name(type $arguments) { /* function body*/ }
- function return_type function_name(type $arguments) { /* function body*/ }
Answer: A) function function_name(type $arguments) : return_type { /* function body*/ }
Explanation:
The syntax of defining function return type in PHP is:
function function_name(type $arguments) : return_type {
/* function body*/
}