Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why does the Zend framework prepend an underscore here?

What's the point of having $_comment instead of $comment?

class Default_Model_Guestbook
{
    protected $_comment;
    protected $_created;
    protected $_email;
    protected $_id;
    protected $_mapper;
like image 233
Citizen Avatar asked Jul 04 '26 11:07

Citizen


1 Answers

Prefixing protected and private class variables is a common convention in PHP. It makes it easier to distinguish between those that are public and those that are protected or private.

like image 59
Jordan Ryan Moore Avatar answered Jul 07 '26 01:07

Jordan Ryan Moore