PHP $var And $$var variables

PHP $var And $$var variables
  • $var and $$var both are different variables
  • $$var is variable of variable $var
  • If we use $$var that means value of variable $var also treat as variable

<?php

$var="html";

$$var="php";

echo $var."</br>";//simple variable display the assign value

echo$$var."</br>";// variable of variable display the assign value

echo$html."</br>";//value of variable $var treat as variable because variable of variable

?>

 

Output


html  //result of simple variable $var

php //result of variable of variable $$var

php //result of value of a variable $var who treat as variable

19 Replies to “PHP $var And $$var variables”

  1. Excellent post. I was checking continuously this blog and I’m impressed! Very helpful info specifically the last part 🙂 I care for such information much. I was looking for this particular info for a long time. Thank you and good luck.

  2. I simply want to say I am just all new to blogging and site-building and really enjoyed you’re blog site. Very likely I’m want to bookmark your site . You actually come with tremendous articles and reviews. Regards for revealing your webpage.

  3. I simply want to mention I am just beginner to weblog and honestly loved you’re web page. Likely I’m want to bookmark your blog . You definitely come with awesome posts. Regards for sharing your blog site.

  4. I just want to mention I am just beginner to weblog and truly loved you’re web page. Most likely I’m want to bookmark your blog post . You absolutely come with good stories. With thanks for sharing your blog site.

Leave a Reply

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