DineSh
06-24-2005, 09:25 AM
my do while loop is not working ......
it loops for only one iteration...
here's the code:
<?php
$tot_days=200;
$day=array('31','28','31',' '......................);//array that contains days of respective month
$i=0;
do{
$tot_days - =$day[$i];
$i++;
}
while($tot_days<0); ///while($tot_days>0); also tried
echo $i+1;
echo $tot_days;
}
it should give $i=7 and $tot_days=19
but it is giving $i=2and $tot_days=169
Please debug this ..................would be very greatful.....ok thanks for reading
it loops for only one iteration...
here's the code:
<?php
$tot_days=200;
$day=array('31','28','31',' '......................);//array that contains days of respective month
$i=0;
do{
$tot_days - =$day[$i];
$i++;
}
while($tot_days<0); ///while($tot_days>0); also tried
echo $i+1;
echo $tot_days;
}
it should give $i=7 and $tot_days=19
but it is giving $i=2and $tot_days=169
Please debug this ..................would be very greatful.....ok thanks for reading