|  | Posted by ZeldorBlat on 05/30/07 23:02 
On May 30, 5:49 pm, "Edwina Rothschild" <edwinarothschil...@mail.md>wrote:
 > Can anyone explain to me why globals are so bad?  I have a $phpEx
 > variable in my main config file and i use "global $phpEx" inside of
 > certain functions that return links so I don't have to change a
 > hundred links if I change my php extension to something else (php4,
 > php5).  Thanks for the great help everyone!  Now if I can just figure
 >
 > regards,
 > Giovanni Macra
 
 It sounds like $phpEx should be a constant then, not a variable.
 
 Globals are bad because they make the code more difficult to read and
 follow.  By using globals you increase the "distance" between where
 something happens and what other things it affects -- which makes
 things more difficult to debug.  If the project is reasonably small
 this isn't too big of a deal, but when things get larger it can
 becomes a problem.
  Navigation: [Reply to this message] |