Foreach loop looping twice
<p>So my problem is that it is looping twice and that is not the desired output that I wanted.So to start of I have a 3 checkbox with each value 1 till 3 which is sent to the database and is divided by a '@|@' sign.</p>

<p>Example of content for $rs_array['package'] for 3 checkboxes picked</p>

<pre><code>1@|@2@|@3
</code></pre>

<p>Down here is the foreach loop of it</p>

<pre><code>if(strpos($rs_array['package'], '@|@') == true){
$array = explode('@|@', $rs_array['package']);
foreach ($array as $myArray) {
    if ($myArray==1) {
        $myArray = "Starter";
    }
    elseif ($myArray==2) {
        $myArray = "Developing";
    }
    elseif ($myArray==3){
        $myArray = "Matured";
    }
    $my_Array[] =  $myArray;
}
//unset($my_Array);
$my_Arrays = implode(',', $my_Array);
}
else{

    $my_Arrays = $rs_array['package'];
    if($my_Arrays==1){
    $my_Arrays = "Starter";
    }
    elseif ($my_Arrays==2) {
        $my_Arrays = "Developing";
    }
    elseif ($my_Arrays==3) {
        $my_Arrays = "Matured";
    }
    else{
        $my_Arrays = "";
    }
}
echo $my_Arrays;
</code></pre>

<p>And down here is the output of the echo when I pick three of them</p>

<pre><code>Starter,Developing,Matured,Starter,Developing,Starter,Developing,Matured
</code></pre>

<p>And here is when I pick two of them</p>

<pre><code>Starter,Developing,Matured,Starter,Developing
</code></pre>

<p>I am still a rookie in this foreach field so do mind that I still can't figure a workaround or even why it display as such.Much help is appreciated</p>

<p>-------problem-----</p>

<p>Now I see the problem that is if I have only one row of $rs_array['package'] it works fine but the problem is if there is two or more.
It just adds up on the second one and so on...
and I need a way so that it identifies that each of those rows are different</p>