views:

221

answers:

4

I cant seem to find any documentation on what $_this means in PHP. It seems to be used quite a bit in the CakePHP framework.

Any ideas?

+2  A: 

$_this is not of any PHP reserved keywords ($this however, is). Perhaps some kind of special variable in CakePHP.

Deniss Kozlovs
+3  A: 

Many individuals like to use some form of variable naming convention. In the case of private variables, people like to use $_ as a convention. I don't particularly know if this is the case in CakePHP, but elsewhere it's frequently seen.

cballou
+4  A: 

An underscore typically denotes the scope of the variable. A variable with a leading underscore often means that it is protected or private. This is just a convention and is not enforced by the language. It helps make the code easier to read.

Brad
+6  A: 

CakePHP follows a general nomenclature where variables starting with $_ are considered private to the class. They are not important for using the framework, however.

spoulson