Here’s what I’d like to do
for($i = 1; $i < 4; $i++) {
$featuredImage$i = $featured['featuredImage$i'];
$featuredText$i = $featured['featuredText$i'];
$featuredURL$i = $featured['featuredURL$i'];
}
How can do I something like that?
Only thing you need is to learn PHP language.
This page contains everything you need: http://php.net/types.string
It worth reading regardless this particular question, as string syntax is one of most basic PHP syntax concepts and you have to learn it by heart anyway.
The only note I have to add: strictly speaking, you’re gonna use a counter not as a part of variable but as a part of string, which, in it’s turn, gonna be a key for the array variable. But syntactically you’re composing a string out of a string and a variable.EDIT
Oh. I didn’t notice leftmost variable.
Only when I started writing another suggestion, I was able to see it.
Well, you may also consider using nested array.
It could be used this way
or do whatever you want to do with these variables.
It would be nice to see the full context which lead you to this question, thus it will be possible to give you best solution for your particular case.
May be you will need dramatically redesign your database…