Return items from array sequentially on each function call, false when no more exist
<p>I need to have a function that sort of acts like mysql resources sometimes do, where you have to "fetch" something as part of a loop until it returns false.</p>

<p>I have something like:</p>

<pre><code>while ($variable = $object-&gt;method())
{
  // Do stuff with variable here
}
</code></pre>

<p>I'm trying to figure out how, on my object, to best keep track of what to send from the method.</p>

<pre><code>class object {
  $values = array(1, 2);
  public function method()
    {
      // First call should return 1, second should return 2, and any subsequent calls should return FALSE
      // Not sure now what to do
      // return $values[$i];
    }
}
</code></pre>
