Friday, 23 November 2018

assigned variable is not working in do while loop in using PHP

I am working on Do While loop in my project its working fine first time. Before while statement, I assigned a value to an array I could able to print the array successfully at bottom of the code but its become 0 when I check at top of the loop. please see the code below

  $looparray =array();
  $loopend =0;
  $arraymer=array();
  $poolafirtsid= previous array values

    do{

        if(sizeof($looparray)==0){
            $firstsponarray= $poolafirtsid;
         }else{
            $firstsponarray= $looparray;
        }
            //print_r($firstsponarray);<- not getting values of $looparray hear

            foreeach($firstsponarray  as $value){
              //execute code   
                  }         

            if(conditaion){
                $loopend = 1;
                //if the conditaion satisfied loop ends
                break;
            }else{
                $loopend = 0;
                $looparray = $arraymer;
                //send $looparray values to top and 
                //print_r($looparray); <- i could able to print values
                                        }
   }while($loopend == 1);

When I print in else its working but I am unable to print starting of do loop its showing array size is 0



from assigned variable is not working in do while loop in using PHP

No comments:

Post a Comment