From:             [EMAIL PROTECTED]
Operating system: OpenBSD 2.7
PHP version:      4.0.3pl1
PHP Bug Type:     *General Issues
Bug description:  Only one var allowed in a class

The following class definition lists three vars, yet they are all treated as one, as 
the call to report() shows.  I'd love to be able to define more vars in a class.

class bankaccount {

     var $balance;
     var $transactions;
     var $history;

     function bankaccount () {
          $this->$balance = 0.00;
          $this->$transactions = 0;
          $this->$history[$transactions] = $this->$balance;

     function report () {
          echo $this->$balance . "<br>";
          echo $this->$transactions . "<br>";
          echo $this->$history[$transactions] . "<br>";

     function credit ($amount) {
          $amount = abs($amount);
          $this->$balance += $amount;

     function debit ($amount) {
          $amount = abs($amount);
          $this->$balance -= $amount;


$USDaccount = new bankaccount;



the result is:



Edit Bug report at:

PHP Development Mailing List <>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to