Code snippet of the day

Sometimes working late has some side-effects. The other day I had a problem with a PHP script that should have taken 1 or 2 seconds to run and instead seemed to hang the webserver. Eventually I found the issue:


while ( $variable ) {
if ( $a == $b )
echo "do something";
}

Ermm… for some reason I never changed the value of $variable and of course the loop became infinite.