Clone a variable in php : <p>I am trying to compute a streak of numbers, I have an array of  containing 1 and 0 back to back, I am trying to find out the longest time one appeared consecutively, to calculate a winning streak I am trying this:</p>

<pre class="lang- prettyprint-override"><code>$l = 56;



$holder = 0;

$streak = 0;

for($i = 1;$i &lt;= $l;$i++){

// all classes is an array contain 1's and 0's.

    $class =  $all_classes[$i];

    if($class == 1){
        $streak++;
    }

    if($class == 0 &amp;&amp; $streak &gt; 0 &amp;&amp; $holder == 0){
   // here is the problem i want to hold the value of streak somewhere
   // before setting it back to 0 to count for next streak
   $holder == $streak;
   $streak = 0;
    }

    if($class == 0 &amp;&amp; $streak &gt; 0 &amp;&amp; $holder &gt; 0){
    // compare both streaks and keep the larger number in holder
    if($streak &gt; $holder)
{
    $holder = $streak;

    $streak = 0;
}
else
{
    $streak = 0;
}
    }

}
</code></pre>

<p>
I know my program is incorrect but any solution?</p>
