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?

  1. function function_name(type $arguments) : return_type { /* function body*/ }
  2. function function_name(type $arguments) , return_type { /* function body*/ }
  3. return_type function function_name(type $arguments) { /* function body*/ }
  4. 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*/ 
}

Comments and Discussions!

Load comments ↻






Copyright © 2024 www.includehelp.com. All rights reserved.