How can you specify a default value for a function argument in PHP?

  • By using the = default syntax.
  • By using the : syntax.
  • By using the ? syntax.
  • By using the ?? syntax.
In PHP, you can specify a default value for a function argument by using the ? syntax before the argument name. This allows the argument to have a default value of null if not provided.
Add your answer
Loading...

Leave a comment

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