PHP Knowledge Base
A Simple Object and How to Access One of its Properties and Methods
Example: Simple Object
class SimpleClass { // property declaration public $var = 'a default value'; // method declaration public function displayVar() { echo $this->var; } }
Example: How to Access an Object Property or Method
$a = new SimpleClass(); echo $a->var; $a->displayVar();