What I wanted was to do something to each array key, with the exception of the last value e.g. produce "col1, col2".
I found a solution by using
$a = array("col1" => array("title"=>"c1title", "hidden"=>false), "col2" => array("title"=>c2title", "hidden"=>true));
$txt = "SELECT ";
foreach($a...