I know what is $var
and $$var
will do. But in an interview they give me a problem which contains $$$var
. What is that means actually. I cant find any reference for that.
Asked
Active
Viewed 85 times
2

Coder Me
- 45
- 5
-
2Variable of variables.. Show us the problem – Thamilhan May 02 '16 at 05:54
-
You can say it nested variables of variables – Narendrasingh Sisodia May 02 '16 at 05:55
-
Like i said i found it on a online interview test. So don't have a backup. – Coder Me May 02 '16 at 05:58
-
thanks . i got it by searching "nested variables of variables". – Coder Me May 02 '16 at 06:01
-
@shoaib see my answer below so you can understand better. – May 02 '16 at 06:01
2 Answers
2
It is Variable variables. This will make you understand:
<?php
$a = 123;
$b = 'a';
$var = 'b';
echo $var; //b
echo $$var; //a
echo $$$var; //123

Thamilhan
- 13,040
- 5
- 37
- 59
1
Simply you can understand the flow:
$var
is a variable and it hold value.
$$var
means the new variable that name is the value of $var
.
and $$$var
means the new variable that name is the value of $$var
.
example:
$var = 'app';
so $$var
will be $app
.
and so on.

Murad Hasan
- 9,565
- 2
- 21
- 42