Reference Variable in php

In this tutorial you will get the knowledge about reference variable. Any variable will be called reference variable, if it contains another variable as its value.


Reference variable in php

<?php
$a="b";

$b="a";

$c=$$b;

echo $c;

?>

Now its output will be b


How?
Let's solve it
  1. $c=$$b;
  2. $c=$a //Because $b value is a
  3. $c=b // Because $a value is b
So $c is a reference variable.

0 comments: