This is kind of embarrassing but I having problems calling a method from a class in PHP, this is how it goes: I have created a class persona with its respectives properties, the code is
<?php class persona { private $id; private $nombre; //varchar(50) private $correo; //varchar(50) private $especialidad; //varchar(50) private $nacionalidad; //varchar(50) private $sueldo; //float private $isss; //float private $afp; //float //getter public function getId() { return $this->id; } public function getNombre() { return $this->nombre; } public function getCorreo() { return $this->descripcion; } public function getEspecialidad(){ return $this->especialidad; } public function getNacionalidad(){ return $this->nacionalidad; } public function getSueldo(){ return $this->sueldo; } public function getIsss(){ return $this->isss; } public function getAfp(){ return $this->afp; } //setter public function setNombre($nombre) { $this->nombre = $nombre; } public function setCorreo($correo) { $this->correo = $correo; } public function setEspecialidad($especialidad){ $this->especialidad=$especialidad; } public function setNacionalidad($nacionalidad){ $this->nacionalidad=$nacionalidad; } public function setSueldo($sueldo){ $this->sueldo=$sueldo; } public function setIsss($isss){ $this->isss=$isss; } public function setAfp($afp){ $this->afp=$afp; } public function __construct($nombre, $correo, $especialidad, $nacionalidad, $sueldo, $isss, $afp, $id=null) { $this->nombre = $nombre; $this->correo = $descipcion; $this->especialidad = $especialidad; $this->nacionalidad = $nacionalidad; $this->sueldo = $sueldo; $this ->isss = $isss; $this->afp = $afp; $this->id = $id; } public function mostrar(){ $mensaje="hola"; return $mensaje; } } ?> as you can see at the end of the code I have created a function called mostrar, the only purpose of this is to show a message, now I want to call this method from a diferent class, my code is
<?php require_once('persona.php'); class prueba{ private $person; public function __construct(){ $person= new persona("el nombre","el correo", "la especialidad", "la nacionalidad", "el sueldo", "el isss", "el afp"); mostrando(); } public function mostrando(){ $person->mostrar(); } } ?> but when I debug it doesn' show anything in the browser, I want to display the message from the class person.php, could you please tell me what is the problem in my code?
echoanywhere, so yeah, nothing is going to show in the browser.