[Previous] [Contents] [Next]


Heterogeneous arrays

The values that can be stored in a single PHP array don't have to be of the same type; PHP arrays can contain heterogeneous values. The following example shows the heterogeneous array $mixedBag:

$mixedBag = array("cat", 42, 8.5, false);

var_dump($mixedBag);

The function var_dump( ) displays the contents (with a little whitespace added for clarity):

array(4) { [0]=> string(3) "cat"
           [1]=> int(42)
           [2]=> float(8.5)
           [3]=> bool(false) }

[Previous] [Contents] [Next]