Its use is in object oriented programming. Consider the following:
class myclass {
public $x;
private $y;
public function get_y () {
return $this->y;
}
public function __construct ($new_x, $new_y) {
$this->x = (int)$new_x;
$this->y = (int)$new_y;
}
}
$myobject = new myclass(5, 8);
echo $myobject->x; // echoes '5';
echo "\n";
echo $myobject->get_y(); // echoes '8'
echo $myobject->y; // causes an error, because y is private
You see how it is used to refer to the properties of an object (the variables we specified in the class definition) and also the methods of the object (the functions). When you use it in a method, it can point to any property and any method, but when used outside the class definition, it can only point to things that were declared "public".