Posted by Rik on 05/17/06 22:51
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;
}
}
$a = new test();
$a->text();
?>
Grtz,
--
Rik Wasmus
Navigation:
[Reply to this message]
|