Comparison of programming languages (associative array): Difference between revisions

Content deleted Content added
m Java: fix var name
Line 551:
 
=== PHP ===<!-- This section is linked from [[PHP]] -->
[[PHP]]'s built-in array type is in reality an associative array. Even when using numerical indexes, PHP internally stores it as an associative array.<ref>About the implementation of [http://se.php.net/manual/en/language.types.array.php Arrays] in PHP</ref> This is why one in PHP can have non-consecutive numerically indexed arrays. The keys have to be scalar values (string, floating point number or integer), while values can be of arbitrary types, including other arrays and objects. The arrays are heterogenous; a single array can have keys of different types. PHP's associative arrays can be used to represent trees, lists, stacks, queues and other common data structures not built into PHP.
 
An associative array can be formed in one of two ways: