Which is the correct syntax of defining a default argument value in PHP?

104. Which is the correct syntax of defining a default argument value in PHP?

  1. function function_name(type $argument_name : value) { /* function body*/ }
  2. function function_name(type $argument_name , value) { /* function body*/ }
  3. function function_name(type $argument_name = value) { /* function body*/ }
  4. All of the above

Answer: C) function function_name(type $argument_name = value) { /* function body*/ }

Explanation:

The syntax of defining a default argument value in PHP is:

function function_name(type $argument_name = value) { 
/* function body*/ 
}

Comments and Discussions!

Load comments ↻






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