I'm learning how to use $$ in PHP, but I'm stuck trying to fix this code.
<?php
$now_test = 0;
print_r($now_test);
$item = 'test';
$now2 = ('$now_'.$item);
echo $now2;
print_r($$now2);
?>
The first print_r
shows me a 0
, an expected value.
Later, I merged '$now_'
and $item
, and test with echo, so I can see that $now2 = '$now_test'
.
But the final statement, the print_r($$now2)
won't work, why? I really don't understand it.
Thanks a lot!