Basics of OOP

From: Date: Tue, 09 Sep 2008 19:09:56 +0000
Subject: Basics of OOP
Groups: php.general 
Request: Send a blank email to php-general+get-279745@lists.php.net to get a copy of this message
Hi, The following bit of code doesn't output anything: <?php class output { var $text; function outputText() { $this->text = "Hello World"; echo $this->text; } } $class = new output(); $class->outputText; ?> As well as the following code: <?php class output { var $text=5; function outputText() { echo $this->text; } } $class = new output(); $class->outputText; ?> Am I doing anything wrong? By the way, the preceding code is just so I understand OOP which finally I've grasped, but am I doing anything wrong as both codes don't output anything?

« previous php.general (#279745) next »