Search code examples
phpsyntaxsigils

double $ statement in php


What does the double $ statement stands for in PHP?


Solution

  • It means a variable variable:

    $a = 'b';
    $b = 'test';
    print $$a; // test
    

    For the most part (although there are exceptions if you know what you're doing) they are bad practice and whenever you see someone using them arrays are probably the better idea.