[thelist] [PHP] Whaddya callit?

Burhan Khalid thelist at meidomus.com
Tue Jul 12 03:35:49 CDT 2005


Maximillian Schwanekamp wrote:
> This may be a stupid question but...  I'm working on an app that I will
> eventually hand off to someone else.  I'm striving for good class/method
> commenting, and it occured to me that I don't really know what this is
> commonly called in php-land:  a two dimensional array consisting of an
> index array of associative arrays.  I call this a recordset array, since
> I cut my teeth on ASP/VBScript.  E.g.:


I suppose recordset array is as good a term as any.  I would simply call 
it a multi-dimentional array (there is no set term for it in PHP).

With your situation, I would give an example of a sample returned array 
in the comments, so programmers will know what to expect.  Your returned 
array is very easy to deal with, so I don't think you'll run into many 
problems:

$db_records = doMagic();
if (is_array($db_records))
{
    foreach($db_records as $rec)
    {
        echo $rec['id'];
        /* etc */
    }
} else {
   echo 'Whoops, something went wrong with doMagic()';
}


Hope this helps :)


More information about the thelist mailing list