[KLUG Programming] PHP arrays vs. structures

Adam Tauno Williams awilliam at whitemice.org
Sat Jul 17 10:59:45 EDT 2004


In PHP one can have both unassociated arrays (true arrays) and
associated arrays (really more like structures).

An unassociated array -
$colors = array('red', 'blue', 'green', 'yellow')

And associated array =
$colors = array([0] => 'red',
                [1] => 'blue',
                [2] => 'green',
                [3] => 'yellow');

If given the variable '$ralph' you can determine that it is an array via
the use of gettype($ralph).  But what is the simplest method of
determining if the array is an array or a structure, since PHP itself
doesn't distinguish between these as two different types.



More information about the Programming mailing list