Hello,

I'm having problems doing something that I thought would be really easy and I'm sure it is!

I have a several multidimensional Arrays and I want to use some of the values inside the arrays as variables.

I can echo the value I want to use as a varible like this:

<?
echo $data[1]['firstName'];
?>

and this obviously echos the first name.

However, what I want to do is use ['firstName'] as a variable. I tried

<?
$data[1]['firstName'] = $firstName;
echo $firstName;
?>

But that does not seem to work.

Any help would be really appreciated!

Thanks!

    Simple fix here.

    $data[1]['firstName'] = $firstName;

    Means make $data[1]['firstName'] equal to $firstName;

    You want:

    $firstName = $data[1]['firstName'];

    (Make $firstName equal $data[1]['firstName'])

      Write a Reply...