Content deleted Content added
→PHP: copy editing, linking, and referencing |
→Pike: copy editing, etc. |
||
Line 1,383:
Associative arrays that can use objects as keys, instead of strings and integers, can be implemented with the <code>SplObjectStorage</code> class from the Standard PHP Library (SPL).<ref>http://php.net/SplObjectStorage</ref>
===
[[Pike (programming language)|Pike]] has built-in support for
<syntaxhighlight lang=Pike>
Line 1,396:
Accessing and testing for presence in mappings is done using the indexing operator. So <code>phonebook["Sally Smart"]</code> would return the string <code>"555-9999"</code>, and <code>phonebook["John Smith"]</code> would return 0.
Iterating through a mapping can be done using
<syntaxhighlight lang=pike>
Line 1,414:
</syntaxhighlight>
Elements of a mapping can be removed using <code>m_delete</code>, which returns the value of the removed index:
<syntaxhighlight lang=pike>
|