Class constructor

From: Date: Sun, 02 Jul 2000 20:07:40 +0000
Subject: Class constructor
Groups: php.db 
Request: Send a blank email to php-db+get-806@lists.php.net to get a copy of this message
Can someone tell me why the following doesn't work? The Cobj function is supposed to be a constructor to initialize the $x variable when a new instance of the Cobj class is created. I get no errors, but there's no output from echo. class Cobj { function Cobj ($x) { $this->$x = $x; } } $o = new Cobj("this"); echo $o->$x; Thanks in advance, -- Randy Perry rgp systems Mac Consulting/Sales

« previous php.db (#806) next »