So today I attempted something which I thought would be possible, but apparently it isn't.
PHP version: 5.6
Take a look at this snippet of code:
$m = 1;
while ($m <= 12) {
    if (! isset($$dataRef[$m])) {
        echo '0,';
    } else {
        echo $$dataRef[$m] . ',';
    }
    $m++;
}
Where $$dataRef is an numerically indexed array, which is by month (e.g. [1 => 12345.67])
What the if statement does is checks if the month number is defined, if it isn't, echo 0, otherwise do the value.
The above snippet results in the if statement not being executed. And I can't figure out why?
However, if the array is then assigned to a "normal" variable, the code works perfectly:
$m = 1;
$data = $$dataRef;
while ($m <= 12) {
    if (! isset($data[$m])) {
        echo '0,';
    } else {
        echo $data[$m] . ',';
    }
    $m++;
}
Anyone able to explain this?
 
     
    