What is an associative array in PHP?

  • An array that uses numeric keys to access its elements.
  • An array that uses string keys to access its elements.
  • An array that automatically assigns keys based on the element's value.
  • An array that only stores a single value.
An associative array in PHP is an array that uses string keys to access its elements. Unlike indexed arrays, which use numeric keys, associative arrays allow you to associate specific keys with their corresponding values. This key-value pairing provides a way to store and access data in a non-sequential manner. The keys in an associative array can be strings or integers, and they are used to retrieve the corresponding values. Associative arrays are useful when you want to organize data based on specific labels or identifiers. 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 *