Nesting string tokenizer in php
<p>I hava a construct like this:</p>

<pre><code>&lt;?php
    $token=strtok($var,";");
    while($token!=false)
    {
        for($i=1;$i&lt;=number_scores;$i++)
        {

            $score_token=strtok($var2,";");
            $k=0;
            while($score_token!=false)
            {
                $k++;
                $score_token=strtok(";");
            }
            $score_token=strtok($var3,";");
            while($score_token!=false)
            {
                $k--;
                $score_token=strtok(";");
            }
            echo $k;
         }
         $token=strtok(";");
     }
?&gt;
</code></pre>

<p>This code is not working as expected as the string tokenizer is being updated by the inner tokenizers and the outer tokenizer is running only once. What is the work around for this??</p>
