php 中的访问修饰符有什么区别?

What is the difference between access modifiers in php?

我完全不理解 php 中的访问修饰符。关于访问修饰符的内存利用率或仅可访问性的差异是否有任何差异..请提出建议。 如果我有以下代码:

public Class Employee {
 public $emp_name='xyz';
 protected $emp_phone='1234567891';
 private $emp_code='101';
 public function getName($name) {
  return 'Employee name is :' . $name;
 }
 protected function getPhone($ph) {
  return 'Employee contact number is :' . $ph;
 }
 private function getCode($id) {
  return 'Employee code is :' . $id;
 }
 $emp = new Employee();
 $emp->getName($emp_name);
 $emp->getPhone($emp_phone);
 $emp->getName($id);
}

现在谁能告诉我上面的变量或函数占用了多少内存。

不,访问修饰符对 Java 或 PHP 中的运行时内存利用率没有影响,对我听说过的任何其他语言也没有影响。

由于某些字节码中的访问修饰符,代码大小可能会增加几个字节,具体取决于它们的编码方式。您的程序必须在其他方面非常高效,才值得为此担心。