Protected properties prefixed with underscores
问题 Like: public $foo = null, $bar = 10; protected $_stuff = null, $_moreStuff = 5; A lot of people seem to do this. Why? Isn't this inconsistent naming (like some PHP functions are :))? 回答1: It really comes down to one thing: personal preference. I, personally, am also one who uses that naming convention. Prefixing anything that is protected or private with an underscore, be it a variable or a function, lets myself and any other programmer who I regularly work with know that that variable is