hello
i want to create a for loop to create variables on the fly:
here's what i have: [this is a multi-dimensional array, my other example follows below]
for ($i=1; $i<=$totalBanners; $i++) {
if ($this->globalProp['banner_img'.$i]) {
$banners[$i] = '../mailer/'.$this->globalProp['banner_img'.$i];
$banners[$i][size] = filesize($banners[$i]);
$banners[$i][type]= filetype(basename($banners[$i]));
//$banners[$i][name]= basename($banners[$i]);
//$banners[$i][fp] = fopen($banners[$i],"r");
//$banners[$i][inc]= fread($banners[$i][fp] ,$banners[$i][size]);
//$banners[$i][inc]= chunk_split(base64_encode($banners[$i][inc]));
echo $banners[$i].'<br>' ;
}
}
what i initially wanted to do was this but did not seem to work:
for ($i=1; $i<=$totalBanners; $i++) {
if ($this->globalProp['banner_img'.$i]) {
$banners.$i = '../mailer/'.$this->globalProp['banner_img'.$i];
$banners.$i .$size = filesize($banners[$i]);
$banners[$i][type]= filetype(basename($banners[$i]));
//$banners[$i][name]= basename($banners[$i]);
//$banners[$i][fp] = fopen($banners[$i],"r");
//$banners[$i][inc]= fread($banners[$i][fp] ,$banners[$i][size]);
//$banners[$i][inc]= chunk_split(base64_encode($banners[$i][inc]));
echo $banners[$i].'<br>' ;
}
}
both of these are giving me problems the multidimensional array seems to only be able to read in the name and thats it, the concatenate gives me more problems for example $banners.$i - carries on forever and eventually gives me a "maximum timeout error" what am i doing wrong here syntax wise?
also have tried : $banner = "banners"
for (....
$banner . $i = '' .
this also did not work as planned
what i essentially want is almost like flash where i can say this["banner"+i] but in php format. tho this will not work because it will refer to the class?
please help, any help appreciated