Setting public class variables
this is the way, but i would suggest to write a getter and setter for that variable.
class Testclass{ private $testvar = "default value"; public function setTestvar($testvar) { $this->testvar = $testvar; } public function getTestvar() { return $this->testvar; } function dosomething() { echo $this->getTestvar(); }}$Testclass = new Testclass();$Testclass->setTestvar("another value");$Testclass->dosomething();