I have the following code, unfortunately it's looping infinity but I can't understand why :
$tot_age is set to 604245119
while ($tot_age > 536467742) {
$tot_age - 31536000;
if ($tot_age < 536467742 ) {
// do something
break;
}
}
So what I'm attempting to here is the following. If $tot_age is greater than 17 years, iterate through the loop and minus 12 months from $tot_age. I'm then attempting to break out of the loop at the point which $tot_age is less than 17 years. I'll apply some logic here too.
Can anyone see an issue here? Thanks
$tot_age - 31536000here,you are just doing an operation in the air as it were.Change it to$tot_age=$tot_age - 31536000;$tot_age -= 31536000;:P