PHP doesn’t want incredible numbers


A naked number used in the source code is an incredible number, because within three months, no one, including the author, made sense of it. For example:

if (22 == $foo) {
    start_thermo_nuclear_war(); 
}
else if (19 == $foo){
    refund_lotso_money(); 
}
else{
    cry_cause_im_lost(); 
}

You should use define() to give the value you want to represent something a real name, rather than using naked numbers, for example:

define("PRESIDENT_WENT_CRAZY", "22");
define("WE_GOOFED", "19");
define("THEY_DIDNT_PAY", "16");
 
if ( PRESIDENT_WENT_CRAZY == $foo) { 
    start_thermo_nuclear_war(); 
}
else if (WE_GOOFED == $foo) {
    refund_lotso_money(); 
}
else if (THEY_DIDNT_PAY == $foo)
{
infinite_loop(); 
}
else{
    happy_days_i_know_why_im_here(); 
}