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

From: Date: Tue, 11 Apr 2006 08:14:05 +0000
Subject: Re: how to assign a value to a variable inside a class
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-233747@lists.php.net to get a copy of this message
Hi there, no much simpler. I do not need to assign the value from outside the class. This is just inside the class. I have the login data for a database saved in a file and would like to use simply the variable $DB_login inside this class. This does not work: $this->db_username = $DB_login; Any idas on how to do this? Thanx a million, Merlin Brad Bonkoski schrieb:
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


« previous php.general (#233747) next »