can you please explain this php code
<p>I am not sure about the while loop and this line <code>$newstring .= "$count{$current}";</code></p>

<p>I do not understand why <code>$i + $count]</code> is used twice.</p>

<pre><code>&lt;?php
$string = "111221";

for($i = 0; $i &lt; strlen($string); $i++) {
    $current = $string[$i];
    $count = 1;

    while(isset($string[$i + $count]) &amp;&amp; ($string[$i + $count] == $current)) 
        $count++;

    $newstring .= "$count{$current}";
    $i += $count-1;
}

print $newstring;
</code></pre>
