How to create a variable outside function but which should not be visible outside my php file?
I mean a global variable with single file scope. I don’t want to add the function name in global namespace which may clash tomorrow.
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.
with PHP5.2 and below, you simply can’t do it. Once it’s global, it’s global.
but from 5.3 onwards, there is Namespacing, which allows different levels of scope.
see here: http://www.ibm.com/developerworks/opensource/library/os-php-5.3new3/index.html