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
2002 12:44 PM
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
I think you're missing the point of variable variables.
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
solution you think of with variable variable
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
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
5 matches
Mail list logo