Can somebody please explain what is the significance of using underscore with the variable name. I mean what is the difference in the following two statements.
int _myage;
int myage;
Let me explain my view. In the language C it has some instructions for the compiler for the handling of this variable. PHP is not a compiler based language. Then what is the use of underscore here.
_variablename and variablename
Moderators: tjay, seadap, Rogue4ngel, matthewhayashida
_variablename and variablename
Work, Work and Work by Quaid E Azam Muhammad Ali Jinnah (Founder of Pakistan)
Re: _variablename and variablename
OK this is the answer to my question. Atlast it has been figured out from the coding standards. Its I think only the convention nothing that techincal.
Private class members (meaning class members that are intented to be used only from within the same class in which they are declared; PHP does not yet support truly-enforceable private namespaces) are preceded by a single underscore. For example:
Example Code
_sort()
_initTree()
$this->_status
Private class members (meaning class members that are intented to be used only from within the same class in which they are declared; PHP does not yet support truly-enforceable private namespaces) are preceded by a single underscore. For example:
Example Code
_sort()
_initTree()
$this->_status
Work, Work and Work by Quaid E Azam Muhammad Ali Jinnah (Founder of Pakistan)
Re: _variablename and variablename
Thanks for posting that. I'm sure it will help many others, including me. 

http://springhillalumni.org • Springhill High School Alumni Association