2

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.

Coder Me
  • 45
  • 5

2 Answers2

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