You are building a function that processes user data. If the user does not provide an age, you want the function to default to 18. Which PHP feature allows you to set this default?

  • Default Parameters
  • Type Hinting
  • Variable Scope
  • Function Overloading
Default parameters in PHP allow you to set a default value for function parameters. If the user does not provide an age, the default value of 18 can be specified in the function signature.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *