Visibility
The decision whether to leave the variable public or not is the programmer's according to need. Not using it elsewhere does not mean it can not be used at some point. What a lot of programmer does not understand is that the class should be thought to be used in a variety of situations. If it is to do something simple, it will not be used in many ways and it will not require complex maintenance, you do not have to create a class. The important thing is to understand why doing things. Handouts serve to provide a basis for technique, but they do not teach people how to think about problems and how to solve them.
The most common object-orientation is to leave variables private until you have a reason to make them public. But I find it reasonable to understand that such data may be needed somewhere in isolation, especially if the class is just that where it would be of little use. I would probably do it that way, if I were to create a class ( this might be useful ).
Making OOP in PHP
Another important point is about methods to access the fields of the class. Some say that they should always be used. This makes up some sense, but many people repeat it without knowing why it is needed. Want to do so, okay, everyone can do as they please, but in PHP there is no need in most cases. PHP is a script language, codes have binding at runtime, so from a technical point of view it makes no difference to access the variable or a method, unless it is known that the method will need to be used in the future. Even in those cases I have my doubts if it is so useful for applications that PHP fits well (I know a lot of people make use of PHP where it does not fit, but there the problem is otherwise).
In most cases it is more interesting to initialize existing members with a constructor. Not always, but need to know when to use a builder , you can not just follow a rule.
Stop Declaring Variables
If the question was about what the bfavaretto said in comment below (the AP showed that it is not), about the variable being created automatically without being declared, it is possible, but not recommended, the reason for creating a class it is precisely to organize the code, to declare what its function, its members, power is one thing, to be certain is another. Some unpredictable things can happen.
Actually this is just one of the reasons I have objections to OOP in PHP, the language was not intended for this, it leaves do much wrong in the name of "simplicity", OOP does not match that. In PHP an object is just an associative array that allows you to insert and remove members at random.
I'm amazed at Unicamp teaching PHP, hopefully it's just some nickel-plating course.