RE: [PHP] Variable variable names...
| From: | Jason Lustig | Date: | Sat, 23 Jun 2001 01:25:47 +0000 |
| Subject: | RE: [PHP] Variable variable names... | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-54949@lists.php.net to get a copy of this message | ||
There's a number of things you can do with variable variables... they're
quite powerful, I like 'em a lot. :)
Anyway, you can do
<?php
$myvar2 = 'stuff';
$othervar = 2;
if (isset($myvar{$othervar}))
echo $myvar{$othervar};
?>
This would output
<snip>
stuff
</snip>
I think that's what you were asking... You've got to use the { and } around
the variables you're using to make teh variable variable.
--Jason