You are writing a PHP script that needs to store multiple items in a single variable. What data type would you use and why?

  • int
  • float
  • string
  • array
To store multiple items in a single variable in PHP, you would use the array data type. Arrays are used to hold collections of values, allowing you to store and access multiple items efficiently. By using an array, you can group related items together, iterate over them, or perform various operations on the entire collection. This makes arrays the suitable data type for scenarios where you need to work with multiple items as a cohesive unit. Learn more: https://www.php.net/manual/en/language.types.array.php
Add your answer
Loading...

Leave a comment

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