What does the dollar sign mean in PHP? I have this code:
<?php
class Building {
public $number_of_floors = 5;
private $color;
public function __construct($paint) {
$this->color = $paint;
}
public function describe() {
printf('This building has %d floors. It is %s in color.',
$this->number_of_floors,
$this->color
);
}
}
$bldgA = new Building('red');
$bldgA->describe();
?>
It seems that the $
indicates a variable like:
$number_of_floors
$color
But I get confused when I see the following:
$bldgA->describe();
$bldgA->number_of_floors;
Why are there no dollar signs before these variables?