Re: how to assign a value to a variable inside a class

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



How about this:

class foo {
   var $name;

   function setName($value) {
      $this->name = $value;
   }
}

-B

Merlin wrote:


Hi there,

I would like to assign a value inside a class like this:

var $db_username = $old_name;

Unfortunatelly this does not work and I do get following error:
Parse error: syntax error, unexpected T_VARIABLE, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}'

Thank you for any hint on how to place a correct syntax on this.

Merlin


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux