Difference between Dollar and Double Dollar in PHP

By | June 3, 2020

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 PHPWe all know that in PHP programming $ is used for declaring variables or when we write a variable name in PHP, use $ before that name.

Difference between Dollar and Double Dollar in PHP

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



Difference between $ and $$ in PHP

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.

Check Also:

Create Dynamically Generated Text File and Download Using JavaScript

Happy Coding..!

Subscribe For Latest Updates

Sign up to best of PHP Code Solutions, informed analysis and opinions on what matters to you.
Invalid email address
We promise not to spam you. You can unsubscribe at any time.

Leave a Reply

Your email address will not be published. Required fields are marked *