lets say:
class myclass{
protected $info;
protected $owner;
__construct(){
$this->info = 'nothing';
$this->owner = 'nobody';
}
function getProp($string){
return $this->$string;
}
}
But its not working, is it not posible? its not returning anything or showing errors
It works fine, but you’re missing the function keyword in front of
__construct. This outputs “nothing”: