2 dimensional array processing

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



If I create the following 2 dimensional associative array:-

$insert["tab2"]["fields1"] = "value1";
$insert["tab1"]["fields2"] = "value2";
$insert["tab2"]["fields5"] = "value3";
$insert["tab1"]["fields7"] = "value4";

how do I do 2 levels of nested loop with the first level looping through the first level of the array and the second nesting through the second.  something like:-

foreach( $insert as $table => $fields ) {
  foreatch( $fields as $field => $value ) {
    echo "update $table set $field = $value";
  }
}

Regards,
Ben






[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux