A function wrote by a co-worker:

PHP:
  1. function test($what, $where) {
  2.     if (!empty($where)) {
  3.         if (!empty($where[$what])) {
  4.             return $where[$what];
  5.         } else {
  6.             return '';
  7.         }
  8.     } else {
  9.         return '';
  10.     }
  11. }

When I had a look at this function I immediatlly tought: Test? What does it test? Thankfully there's the $what argument! And look! A $where argument too!

WTF? Folks, name your functions and variables properly.

blog comments powered by Disqus

Português flagItaliano flagCoreano flagChinês (simplificado) flagEnglish flagAlemâo flagFrancês flagEspanhol flag
Japonês flagÁrabe flagRusso flagHolandês flagBúlgaro flagTcheco flagCroata flagDinamarquês flag
Finlandês flagHindu flagPolonês flagRomeno flagSueco flagGrego flagNorueguês flag 
By N2H
96 DOLETAS de desconto na hospedagem Dreamhost!
Use o "PROMO CODE" INERCIA. LAMP com 20GB de espaço e 1TB de transferência.

Artigos relacionados

Categories