Re: Classe Variable
| From: | Petar Nedyalkov | Date: | Wed, 20 Apr 2005 11:37:00 +0000 |
| Subject: | Re: Classe Variable | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-213487@lists.php.net to get a copy of this message | ||
On Wednesday 20 April 2005 13:29, marc serra wrote:
> Hi,
> i got a problem to write automaticaly varibles in classes.
>
> i got a simple object name test like this
>
> classes Test{
> public $id;
> public $text;
> }
>
> i want to affect my value to my variable like this
> $test = new Test
>
> $champ = id;
> $valeur_champ = 4;
>
> $test->$champ = $valeur_champ;
Just use $test->{$champ}
;-)
>
> my example is stupid i know but its just for an example.
> in fact when i write $test->$champ = $valeur_champ; I want that php
> execute $test->id = 4;
>
> can someone help me plz,
>
> Marc.
--
Cyberly yours,
Petar Nedyalkov
Devoted Orbitel Fan :-)
PGP ID: 7AE45436
PGP Public Key: http://bu.orbitel.bg/pgp/bu.asc
PGP Fingerprint: 7923 8D52 B145 02E8 6F63 8BDA 2D3F 7C0B 7AE4 5436
Attachment: [application/pgp-signature]
Attachment: [application/pgp-signature]