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.
Loading...
Related Quiz
- In PHP, an abstract class is defined using the abstract keyword.
- In PHP, a multidimensional array can only contain indexed arrays.
- You need to access information about the server in your PHP script. How would you do this using a superglobal?
- You need to access data sent via a form in your PHP script. How would you do this using the $_REQUEST superglobal?
- Which of the following are common uses of indexed arrays in PHP?