There is a pattern that goes like this:

```
1
11
21
1211
111221
...

```

I'm trying to write PHP code to output this, but my output is:

```
1
11
21
12
11
21
12
...

```

Here's the code:

```
<?
$sequence = "1";

for ($i = 0; $i < 99; $i++) {

    echo "{$sequence}<br />";

    $n = 0;
    $x = 0;
    $z = 1;

    $newsequence = "";

    for ($y = count($sequence); $y > 0; $y--) {
        while ($sequence[$n] == $sequence[$n + 1]) {
            $z++;
            $n++;
        }

        $newsequence .= "{$z}{$sequence[$n]}";
    }   

    $sequence = $newsequence;
}

?>

```

What am I missing?