I have the following structure:
$text_1 = $this->getValue('value_1');
$text_2 = $this->getValue('value_2');
$text_3 = $this->getValue('value_3')
And also the following:
foreach($text_1 as $t_1)
{
if(!$first)
{
$string_1 .= ",";
}
$first = false;
$string_1 .= $t_1;
}
foreach($text_2 as $t_2)
{
if(!$first)
{
$string_2 .= ",";
}
$first = false;
$string_2 .= $t_2;
}
foreach($text_3 as $t_3)
{
if(!$first)
{
$string_3 .= ",";
}
$first = false;
$string_3 .= $t_3;
}
I was wondering if this could be re-factored to use a counter, like in a for loop, to replace the _1, _2, _3 etc from my code?