Hi,

Sunday, March 16, 2003, 4:52:10 AM, you wrote:
CK> Hi all,

CK> I have an array that gives me this when I do:

CK> print_r($my_array);

CK> Array
CK> (
CK>      [0] => Array
CK>          (
CK>              [dra_id] => 5
CK>          )

CK>      [1] => Array
CK>          (
CK>              [dra_id] => 8
CK>          )

CK>      [2] => Array
CK>          (
CK>              [dra_id] => 9
CK>          )

CK> )

CK> using a foreach() I want to create a variable with a unique incremental 
CK> name for each of the values.

CK> for example:

CK> $dra_1 = 5;
CK> $dra_2 = 8;
CK> $dra_3 = 9;

CK> How would I do this? A variable that has a variable name based on a 
CK> counter in the loop? Not sure the syntax for that.

CK> Thanks
CK> Charles

something like this...

while(list($key,$val) = each($my_array)){
        $n = 'dra_'.$key+1;
        $$n = $val['dra_id'];
}





-- 
regards,
Tom


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to