The issue: Prevent user from accessing private object values.
<?php
class ScopeModel {
private $private;
protected $protected;
public $public = 'public';
public function __construct() {
// All properties can be accessed inside class
$this->private = 'private';
$this->protected = 'protected';
}
}
$object = new ScopeModel();
echo $object->public, "\n";
// Would result in a fatal Error
// echo $object->private, "\n";
// echo $object->protected, "\n";
?>
Output
public
Protected properties and methods can not be accessed by inherited classes.