Solved the problem thanks to all of your tips. Thanks a lot for all the answers. d(^_^d)
I am having the following problem. I have the numbers 1/2/3/4/5/6 and I want to separate them into two groups 1/3/5 and 2/4/6. The selection must take place based on the position. This part works ok. The problem comes when I want to group them again, when I use the implode function; it only sees the last number that was stored. I know it has something to do with me using this notation (I chose this way since the amount of numbers to classify varies every time):
$q++;
$row0 = $row0 + 2;
$row1 = $row1 + 2;
but I can't figure a way to fix it or another way to get the same result. Hopefully someone here can point me in the right direction. I left the complete code below.
<?
$string = "1/2/3/4/5/6";
$splitted = explode("/",$string);
$cnt = count($splitted);
$q=0;
$row0=0;
$row1=1;
while($cnt > 2*$q)
{
$p_row = implode(array($splitted[$row0]));
echo "$p_row <br>";
$i_row = implode(array($splitted[$row1]));
echo "$i_row <br>";
$q++;
$row0 = $row0 + 2;
$row1 = $row1 + 2;
}
$out = "implode(',', $i_row)";
var_dump($out);
?>