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

Content deleted Content added
copy editing "Raku" subsection (renamed "Perl 6 (Raku)")
PHP: copy editing, linking, and referencing
Line 1,332:
</syntaxhighlight>
 
=== [[PHP]] ===
[[PHP]]'s built-in array type is, in reality, an associative array. Even when using numerical indexes, PHP internally stores itarrays as an associative arrayarrays.<ref>About the implementation of [http://se.php.net/manual/en/language.types.array.php Arrays] in PHP</ref> This is why one inSo, PHP can have non-consecutiveconsecutively numerically -indexed arrays. The keys have to be of integer or string (floating point numbers are truncated to integer) or string type, while values can be of arbitrary types, including other arrays and objects. The arrays are heterogeneous;: 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 declared using the following syntax:
Line 1,379:
</syntaxhighlight>
 
PHP has an [http://php.net/array extensive set of functions] to operate on arrays.<ref>http://php.net/array</ref>
 
IfAssociative you want an associative arrayarrays that can use objects as keys, instead of strings and integers, you can usebe implemented with the [http:<code>SplObjectStorage<//php.net/SplObjectStorage SplObjectStorage]code> class from the Standard PHP Library (SPL).<ref>http://php.net/SplObjectStorage</ref>
 
=== [[Pike (programming language)|Pike]] ===