Jump to content

Variable numbers


Spetter

Recommended Posts

My database returns values in a structure so I can read the values as

 

var_1 = $this->product->value_1;
var_2 = $this->product->value_2;

 

 

Now I want to do something like

for ($counter = 1; $counter <= 5; $counter++)
{
var_$counter = $this->product->value_$counter;
}

 

I know that this is wrong, but is there a solution to do something simular?

Link to comment
https://forums.phpfreaks.com/topic/120189-variable-numbers/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.