What is the difference between $_foo and _foo in php?
What is the difference between $_foo and _foo in php?
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.
The first refers to a variable named
_foo. The second refers to a global constant named_foo.By default PHP will issue low-severity errors when you try to access an undefined variable or undefined constant. In such cases, the “value” of the variable will be assumed to be
nullwhile the “value” of the constant will be assumed to be the stringified version of its name — in this case,'_foo'.