mercredi 27 janvier 2016

assign variable if condition match in for loop

I have a array where i check some condition if condition match,then next array must be the after current array

//$$user_all_activity take all activity of user A
if(!$user_all_activity == NULL)
{
    $size = sizeof($user_all_activity);
    //$prev_array = array();
    for( $i=0; $i<$size-1;$i++)
    {
        if($i>3)
        {
                $prev_array = $user_all_activity[$i-4];
                $current_array = $user_all_activity[$i];
                //get difference check for difference 10
                if($this->getDifference($current_array,$prev_array))
                {
                        echo "Table update at id ".$current_array['id']."      </br>";

                }
                //now what i need is if once condition match the 
                //$prev_array must be after $current_array and again check   the same condition
                //$this->getDifference

         }
    }
 }

I comment the condition what i need.Please someone help me.Thanks in advance

Aucun commentaire:

Enregistrer un commentaire