What is the syntax to declare an array in PHP?

  • <>/array(, , ...)
  • <>/array[, , ...]
  • [, , ...]
  • array(, , ...)
The syntax to declare an array in PHP is array(, , ...). Alternatively, you can also use the shorthand syntax [, , ...]. The values can be of any data type, and they are separated by commas. The array can be assigned to a variable or used directly in the code. Learn more: https://www.php.net/manual/en/language.types.array.php#language.types.array.syntax
Add your answer
Loading...

Leave a comment

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