Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Back End Not getting it? Reply To: Not getting it?

#183410
__
Participant

Sorry, I used the method name from Alen’s example (but copied the class definition from yours). Fixed.

edit
I usually name “getter” and “setter” methods get{propertyName} and set{propertyName}, just to make their purpose obvious.

Also, if you decide to use private (or protected) properties or methods, it is a very common convention to start their name with an underscore (i.e., $_name instead of $name). Again, it just keeps things easy to read and understand.