Re: how to assign a value to a variable inside a class
| From: | Dave Goodchild | Date: | Mon, 10 Apr 2006 17:40:08 +0000 |
| Subject: | Re: how to assign a value to a variable inside a class | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-233678@lists.php.net to get a copy of this message | ||
use a setter function. Direct var assignments must be simple constants. A
setter function enforces encapsulation.
On 10/04/06, Merlin <news.groups@web.de> 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
>
>
--
http://www.web-buddha.co.uk
dynamic web programming from Reigate, Surrey UK
look out for e-karma, our new venture, coming soon!