I want to assign variable name $filename1, $filename2, $filename3 so I write code like this
for ($i=1; $i <= 3; $i++) {
$filename.$i = 'images/location/'.$i;
}
but It error.
Now I use array to fix problem. But anyway I still wonder, is it possible to assign variable name with ordinal number suffix by using loop?
$filename = array();
for ($i=1; $i <= 3; $i++) {
$filename[] = 'images/location/'.$i;
}