Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • Difference Between $a and $$a in PHP

    • 0
    • 1
    • 1
    • 2
    • 0
    • 0
    • 0
    • 0
    • 1.96k
    Comment on it

    $$a uses the value of the variable whose name is the value of $a.
    It means $$a is known as reference variable where as $a is normal variable.
    It allows you to have a variable of variable This program can create the variable name the same way it can create any other string.

    PHP

    <?php
    
        $test = "hello findnerd";
        $a = "test";
        echo $$a;
    
        //output will be hello findnerd
    ?>
    

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: