for ($i=0; $i<2; $i++) { $graphic.$i = $pers_dcr_files{$key[$i]}{GraphicName}; $url.$i = $pers_dcr_files($key[$i]}{url}; }