PHP arrays in arrays

PHP question...

I have an SQL query that's pulled back user IDs as a set of columns. Rather than IDs, I want to use their names.
So I have an array of columns $col with values 1,7,3,12 etc and I've got an array $person with values "Fred", "Bert", "Tom" etc

So what I want to do is display the $col value but the person's name, not the id...
ie
$person[$col[1]] should display "Fred"
$person[$col[3]] should display "Tom"
etc

However, this doesn't want to parse correctly and I get errors, with or without quotes. I've verified that $col[1] is 1 and $person[1] is "Fred", for example. What syntax is required?

Any help appreciated.

Jerry

<removed>

<?php

$a=array(1 => "Fred");
$b=array(1 => 1);

echo $a[$b[1]], "\n";

?>

works. So I think your issue is not with your nested arrays but with some other area of syntax.

Try

<?
print_r($col);
print_r($person);
?>

in order to see data structure