Constantly cycling string
<p>What would an efficient method of making a constantly cycling string in PHP?</p>

<p>Im trying to make it so that string $r cycles between these characters:</p>

<p>-</p>

<p>\</p>

<p>|</p>

<p>/</p>

<p>so that it looks as if it were animated when it's echoed. I tried making an infinite loop like this:</p>

<pre><code>while(1) {
    $r = "-";
    $r = "\";
    $r = "|";
    $r = "/";
}
</code></pre>

<p>but the page wouldn't load, so I would assume that it wouldn't load because it wont load any content until the loop is finished.</p>
