Is there a standard naming convention that is accepted for PHP?

I found PEAR's suggestions here, but they don't give many guidelines at all.

Specifically I am trying to figure out what, if anything, a double underscore leading the name of a variable in a class is supposed to indicate, if anything. i.e. $__blah.
According to PEAR a single underscore is supposed to indicate that a variable is private. Is a double underscore taken as the same thing? Maybe that is supposed to indicate protected?

    Since PHP currently has not concept of public/protected/private variables inside classes many developers use the underscore(s) to signal a private member. Basically if you see a variable prefixed with any number of underscores in a class it is usually because the developer doesn't want you to mess with it outside of the class.

    Check the functionality of the class and I'm sure you see why you don't want to set those variables by hand.

      Thanks, that's what I thought.

      Yeah, I understood why it wasn't supposed to be used outside the class, just wasn't sure why they used more than one underscore. Guess it doesn't make a difference 🙂

        Write a Reply...