tag:blogger.com,1999:blog-961885452063004235.post5411705790012563092..comments2023-10-28T05:31:44.275-07:00Comments on Lennie De Villiers Blog: Weekly Source Code: Default Controlling Access - Be Careful!Lennie De Villiershttp://www.blogger.com/profile/10415773294674948844noreply@blogger.comBlogger2125tag:blogger.com,1999:blog-961885452063004235.post-14376145240275582192009-02-02T03:33:00.000-08:002009-02-02T03:33:00.000-08:00Well it make sense not to have two variables with ...Well it make sense not to have two variables with the same name since a) you will end up not knowing the type of the variable since PHP get the type from the value assigned to it e.g. $name = "Lennie"... then later on you might say again: $name = 5; oops!<BR/><BR/>Also global scope yes but that is bad, if you look at the C programming language - all variables are also global scope and you can access then from another source file/header BAD!!<BR/><BR/>I would say the rules in this case is:<BR/><BR/>1) always have unique names<BR/>2) never change variable types, only stick to a type<BR/>3) don't have globals but use local scopeLennie De Villiershttps://www.blogger.com/profile/10415773294674948844noreply@blogger.comtag:blogger.com,1999:blog-961885452063004235.post-25070316836978589002009-02-02T00:49:00.000-08:002009-02-02T00:49:00.000-08:00I understand all PHP variables have global scope, ...I understand all PHP variables have global scope, and one cannot have two variables of the same name in one project? <BR/><BR/>Not that it's good practice anyway - but still pretty scary._sithu_https://www.blogger.com/profile/15726804345379154373noreply@blogger.com