Why does peter appear in the browser when I follow the teacher's instructions but not in the teacher's browser?
class Staff{ private $anme; private $age; private $salary;
public function __construct($name,$age,$salary) { $this -> name = $name ; $this -> age =$age; $this -> salary =$salary; }}
$obj =new Staff('peter',28,5000);
echo $obj ->name;
thanks for the reply. I later found out too.
Help you find the reason. Your first variable is declared as $anme, and the output is name
It seems because your constructor is public