<?php
class Foo
{
protected $protected1 = 'protected1';
public function test1()
{
var_dump($this->protected1);
var_dump($this->protected2);
}
}
class Bar extends Foo
{
protected $protected2 = 'protected2';
public function test2()
{
var_dump($this->protected1);
var_dump($this->protected2);
}
}
(new Bar)->test1();
(new Bar)->test2();