I am seeing both of them used in this script I am trying to debug and the literature is just not clear. Can someone demystify this for me?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Dynamic Scoping. It is a neat concept. Many people don’t use it, or understand it.
Basically think of
myas creating and anchoring a variable to one block of {}, A.K.A. scope.So a
myvariable is what you are used to. whereas with dynamic scoping $var can be declared anywhere and used anywhere. So withlocalyou basically suspend the use of that global variable, and use a ‘local value’ to work with it. Solocalcreates a temporary scope for a temporary variable.This should print: