Reply to Re: Variable Variables in Classes

Your name:

Reply:


Posted by Alan Little on 05/17/06 23:18

Carved in mystic runes upon the very living rock, the last words of Rik
of comp.lang.php make plain:

> Alan Little wrote:
>> class example {
>> var $Stage;
>>
>> function example() {
>> $this->Stage = 'init';
>>
>> $x = ???????;
>>
>> echo $$x;
>> }
>> }
>>
>> What do I put in $x so that $$x gives me "init"? 'Stage' doesn't work,
>> nor does 'this->Stage'.
>
> Why use the $$ syntax?
>
> <?php
>
> class test{
> var $string;
> function text(){
> $this->string = "This works";
> $check = 'string';
> echo $this->$check;

Ah, yes that works. Thank you.

--
Alan Little
Phorm PHP Form Processor
http://www.phorm.com/

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация