Re: how call a variable in a text

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 





Erm, the braces are meant to go *around* the variable, not around a bit of it:

print "Test: {$var[0][0]}";

Thanks,
Ash
http://www.ashleysheridan.co.uk



In many cases braces can go around the variable name not the necessarily around the whole variable (like the bash scripts). Those are coming from the manual:

<?php
${date("M")} = "Worked";
echo ${date("M")};
?>

function test() {
   // NULL -- not what initially expected
   $string = '_POST';
   var_dump(${$string});

   // Works as expected
   var_dump(${'_POST'});

   // Works as expected
   global ${$string};
   var_dump(${$string});

}

So no they are not meant to go around. You can use them this way as well.

--
Thodoris


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux