Re: how call a variable in a text

From: Date: Thu, 22 Oct 2009 09:31:33 +0000
Subject: Re: how call a variable in a text
References: 1 2 3 4 5 6 7 8 9 10  Groups: php.general 
Request: Send a blank email to php-general+get-299186@lists.php.net to get a copy of this message
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

« previous php.general (#299186) next »