I think you're missing the point of variable variables.
?
$a = 'foo';
$$a = 'bar';
echo $a $$a;
?
After the first use of $$a, you now have a variable called $foo with a
value of 'bar'.
So your echo would be echo $a $foo;
I kind of consider variable variables the poor mans array. Most any
I'm trying to use variable variables to work on arrays:
$forest = array(a, b, c, ...);
$layer[$l]= forest;
Now I want to access all array members of $forest using $$layer:
e.g.
for($c = 0; $c $$layer[$l]; $l++) {
echo $$layer[$l][$c];
}
But this doesn't work, gives syntax error,
So my
On Friday 14 June 2002 00:38, John Holmes wrote:
I think you're missing the point of variable variables.
Quite :-)
I kind of consider variable variables the poor mans array. Most any
solution you think of with variable variables could be better solved by
using arrays.
Actually variable
well, the first method is the same as saying
$a = foo;
$foo = bar;
echo $a $foo;
whereas the second method is appending bar to $a (thus making it foobar)
In first method, you get two variables, the second, just one
-Original Message-
From: Peter [mailto:[EMAIL PROTECTED]]
Sent:
To: 'Peter'; Php
Subject: RE: [PHP] Varible Varibles
well, the first method is the same as saying
$a = foo;
$foo = bar;
echo $a $foo;
whereas the second method is appending bar to $a (thus making it foobar)
In first method, you get two variables, the second, just one
-Original Message
5 matches
Mail list logo