Oh no! Where's the JavaScript?
Your Web browser does not have JavaScript enabled or does not support JavaScript. Please enable JavaScript on your Web browser to properly view this Web site, or upgrade to a Web browser that does support JavaScript.

Avoid Deep Nesting

With many nested levels the code is harder to read and follow, even with proper Indentation.

INCORRECT
Code
function do_stuff() {
   // Things to do
   if (is_writable($folder)) {
      if ($fp = fopen($file_path,'w')) {
         if ($stuff = get_some_stuff()) {
            if (fwrite($fp,$stuff)) {
               // Things to do
            } else {
               return FALSE;
            }
         } else {
            return FALSE;
         }
      } else {
         return FALSE;
      }
   } else {
      return FALSE;
   }
}


CORRECT
Code
function do_stuff() {

// Things to do

   if (!is_writable($folder)) {
      return FALSE;
   }

   if (!$fp = fopen($file_path,'w')) {
      return FALSE;
   }

   if (!$stuff = get_some_stuff()) {
      return FALSE;
   }

   if (fwrite($fp,$stuff)) {
   // Things to do
   } else {
      return FALSE;
   }
}