I have a simple PHP class, I’m trying to access a property of that class from a method in that class. I’ve tried the $this->property_name syntax and that doesn’t appear to work. What am I doing wrong?
class NavigationBuilder {
public $mPage;
public $mGeoID;
public $mContinent;
public $mCountry;
public $mRegion;
private $Geograph = 'a';
public function construct_navigation() {
}
public function __construct() {
var_dump($Geograph);
}
}
You are correct that you need to use
$this->property.Your example works if you use
$this