Page 1 of 1

[SOLVED]var from var

Posted: Fri Jul 23, 2004 1:16 pm
by pppswing
Hello,
I've got a variable, let's say

Code: Select all

$a = 'bof';
and I got

Code: Select all

$bof = 'mytext';

and I want to get $bof through $a. How can I do that ?

Code: Select all

$$a
A this time I dont know if $a is 'bof' or 'super', because in fact I got

Code: Select all

$b = array('bof', 'super',...);
what I want is $$b[$i] but I dont know if it works puting $$ ?

Thanks

Posted: Fri Jul 23, 2004 1:20 pm
by jslick
I don't think I understand. If you want $a to equal $bof ($a to equal 'mytext') then you say $a=$bof;
I don't believe I helped because I don't fully understand your question.

Posted: Fri Jul 23, 2004 1:34 pm
by pppswing
I want $$a i've never said that I want $a = $bof;

I got :

Code: Select all

$a ='bof';
$bof = 'my text';
$c = $$a; /* I want it to be 'mytext' */

Posted: Fri Jul 23, 2004 1:41 pm
by jtc970
that works when I test it