Visibility Operators in PHP

Did you know that visibility operators are REQUIRED for php properties (class variables) and NOT REQUIRED for class methods (functions)?

These are one the many rules that drive me nuts about PHP.

"Class properties must be defined as public, private, or protected. If declared using var, the property will be defined as public."
"Class methods may be defined as public, private, or protected. Methods declared without any explicit visibility keyword are defined as public."

Can you guys (PHP people out there) make the properties public by default (if no visibility operator is used). I used to use “var” but now “var” is obsolete. Have some consistency for God’s sake.


Let's share thisShare on Facebook
Tweet about this on Twitter
Share on LinkedIn