No, the .
is only for concatenating strings. public
variables (as well as functions) will be accessible directly from "outside" using the ->
operator, while protected
and private
variables (and functions) will need getter and setter functions to be accessed. An example would look like this:
class MyClass {
public $variableA;
protected $variableB;
public function setB($varB) {
$this->variableB = $varB;
}
public function getB() {
return $this->variableB;
}
}
$object = new MyClass();
$object->variableA = "new Content"; // works
$object->variableB = "new Content"; // generates an error
$object->setB("new Content"); // works