0
I don't understand concept of variable variable
means how it works
7 Antworten
+ 4
as an example:
<?php
//You can even add more Dollar Signs
$Bar = "a";
$Foo = "Bar";
$World = "Foo";
$Hello = "World";
$a = "Hello";
$a; //Returns Hello
$a; //Returns World
$$a; //Returns Foo
$$a; //Returns Bar
$$$a; //Returns a
$$$a; //Returns Hello
$$$$a; //Returns World
//... and so on ...//
?>
+ 3
sorry, I don't get your question. Could you explain what do you mean with "variable variables"
+ 2
ohhhh now I get it, you mean the $-concept.
it's simple:
$name = "Hello";
$name = "World!";
now the first variable $name stores the string "Hello"
and the second variable, which is now $Hello stores the string "World!"
to output them you can use:
<?php
echo "$name ${$name}";
?>
or:
<?php
echo "$name $Hello";
?>
+ 1
a variable is a place where you can store information and access it later
+ 1
thanks kamil
somehow its helping me
0
I want variable variables meaning not variable. I know variable is what but I don't understand the concept of variable variables
0
well its a concept in php called variable variables