Tuesday, September 21, 2021
How can we help?
< All Topics
Print

Difference Between $ and $$ in php

$name (single dollar) is a simple variable which is used to store string, integer, float etc..

$$name (double dollar) is a reference variable that store the variable with single dollar ($name) value inside it.

To understand this difference let’s take an example.

<?php
   $name = "Infojackers";
   $$name = "Checkout new blogs post.";
   echo $name."<br>";
   echo $$name."<br>";
   echo $infojackers;
?>

//OUTPUT OF ABOVE PROGRAM……

// Infojackers
// Checkout new blogs post.
// Checkout new blogs post.
Next How to make first program in php- As a beginner
Table of Contents