Hi Guys.
Right now I am working on a property site and I got there a variable $$link. So I want to know the difference between $link & $$link and also I want to know that what is the use of $_SERVER['DOCUMENT_ROOT'] variable.
Thank you.
Variables in PHP
Moderator: General Moderators
Re: Variables in PHP
$$variable will declare a variable that is named as whatever $variable is. Kind of difficult to explain, let me show you:
As for $_SERVER and other reserved variables, check out the manual!
Code: Select all
$variable = "hello";
$$variable = "this is my new variable"; // You can call this variable by using $hello, as you can see below:
echo $hello; // echoes "this is my new variable"
Re: Variables in PHP
Variable variablesA variable variable takes the value of a variable and treats that as the name of a variable.
$_SERVER'DOCUMENT_ROOT'
The document root directory under which the current script is executing, as defined in the server's configuration file.