Today we check the difference between single dollar ($) and double dollar ($$).
Here is a most confusing question that, what is the Difference between dollar and double dollar in PHP. We all know that in PHP programming $ is used for declaring variables or when we write a variable name in PHP, use $ before that name.
First thing, in the single dollar ($) stored data is fixed while in the double dollar ($$) is changed dynamically. Variable means are changeable. With explanation variables are those things which are changeable on time.
$var: represnts a variable
$$var (variable’s variable): represents a varibale with the content of $var
Now we check the major difference between $ and $$ with the help of an example below,
Example Difference between Dollar and Double Dollar in PHP
$var = "PHCODERTECH";
$var2 = "var";
Use our PHP ONLINE EDITOR
Explanation of the single dollar ($) and double dollar ($$) Example
$$var2 => $($var2) => $var => PHPCODERTECH
The double dollar is a very useful feature of PHP where you can use for assign variable value dynamically.