Result Size: 1264 x 19
x
 
<!DOCTYPE html>
<html>
<body>
<?php
class Fruit {
  public $name;
  public $color;
  public $weight;
  function set_name($n) { // публичная функция (по умолчанию)
    $this->name = $n;
  }
  protected function set_color($n) { // защищенная функция
    $this->color = $n;
  }
  private function set_weight($n) { // частная функция
    $this->weight = $n;
  }
}
$mango = new Fruit();
$mango->set_name('Mango'); // OK
$mango->set_color('Yellow'); // ERROR
$mango->set_weight('300'); // ERROR
?>
</body>
</html>