To use this website fully, you first need to accept the use of cookies. By agreeing to the use of cookies you consent to the use of functional cookies. For more information read this page.

Official ZPE/YASS documentationAssociative arrays

Associative arrays are similar to those found in PHP, as well as having similarities to dictionaries. They differ from ordinary lists in that they store a pair of values. It stores a key which is used to access a value. The key is the left of the fat arrow.

$a = [44 => 32, 99 => 93]

The empty associative array, which can particularly useful when determining the type of a variable, is represented as [=>]:

$a = [44 => 32, 99 => 93]
print(get_type($a) == get_type([=>]))

Prior to version 1.5.3, associative arrays were enclosed in braces ({ }) as opposed to the square brackets used now ([ ]). This change made only a small difference to coding and has no effect on the underlying representation of associative arrays.


There are no comments on this page.

New comment
Feedback 👍
Comments are sent via email to me.