<?php class A { protected string $city = "CityB"; private string $name = "NameA"; public function getDataA() { return [ $this->city, $this->name ]; } } class B extends A { public string $city = "CityB"; public string $name = "NameB"; public function getDataB() { return [ $this->city, $this->name ]; } } $c = new B; var_dump($c, $c->getDataA(), $c->getDataB());
You have javascript disabled. You will not be able to edit any code.