Which of the following are true about indexed arrays in PHP?

  • Indexed arrays use string keys to access elements.
  • Indexed arrays preserve the order of elements.
  • Indexed arrays can have elements of different data types.
  • Indexed arrays can only store a single value.
The correct option is 2. Indexed arrays in PHP use numeric keys to access elements, not string keys. Indexed arrays preserve the order of elements, allowing for sequential access. Indexed arrays can indeed store elements of different data types, including strings, integers, floats, booleans, and even other arrays. Indexed arrays can store multiple values and are a versatile data structure in PHP. 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 *