Your example works fine. Note you can also use arrays in really cool ways, like so:
$arr[0]["lname"]="Marlowe";
$arr[0]["fname"]="Scott";
$arr[1]["lname"]="Smith";
$arr[1]["fname"]="John";
$fields=array("lname","fname");
print "UserNames:<BR><BR>";
$rows=count($arr);
$cols=count($fields);
for ($i=0;$i<$rows;$i++){
for ($j=0;$j<$cols;$j++){
print $arr[$i][$fields[$j]];
}
print "<BR>";
}
print "Field Names: ".implode(":",$fields)."<BR>";
print 'Array Keys of $arr[0]: '.implode(":",array_keys($arr[0]))."<BR>";