PHP - Use foreach on a two dimentional (or more) array.

http://www.zend.com/manual/control-structures.foreach.php

/* foreach example 4: multi-dimensional arrays */

$a[0][0] = \"a\";
$a[0][1] = \"b\";
$a[1][0] = \"y\";
$a[1][1] = \"z\";

foreach ($a as $v1) {
    foreach ($v1 as $v2) {
        print \"$v2\\n\";
    }
}

Related Scribbles:
  • PHP Syntax and other Notes


  • ID: 333
    Author:
    leonard
    Date Updated:
    2003-12-23 00:22:55
    Date Created:
    2003-10-03 15:42:47

    Edit

    Comments?
     >> Leonard Chan's Homepage  >> Scribble Web  >> PHP - Use foreach on a two dimentional (or more) array.
    leonard.lotus-land.ca is hosted by Perceptus Solutions Inc.