I have few FOREACH loops in php;
$c1 = 1;
$c2 = 1;
$c3 = 1;
foreach ($someArray as $a){
echo $a;
if (sizeof($someArray != $c1){
echo " / ";
}
$c1++;
}
foreach ($otherArray as $b){
echo $b;
if (sizeof($otherArray != $c2){
echo ", ";
}
$c2++;
}
// etc.
This seems somehow stupid, of course =) Is there any way to avoid declaring variables with same values and to use them in many FOREACH loops? Thanks in advance for any help!
It appears you are trying to do what the following code does much better:
$line = implode(' / ', $someArray);
echo $line;
$line = implode(', ', $otherArray);
echo $line;