RE: [PHP] Variable variable names...

2001-06-23 Thread Jason Lustig

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


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Variable variable names...

2001-06-22 Thread Brian Weisenthal

turns out my subject was right on anyone interested check this page
out.
http://www.phpbuilder.com/manual/language.variables.variable.php

Brian Weisenthal [EMAIL PROTECTED] wrote in message
9h02nm$n7c$[EMAIL PROTECTED]">news:9h02nm$n7c$[EMAIL PROTECTED]...
 let say i wanted to see if a variable existed by the name of $myvar2  .
how
 can i make the '2' come from a variable. so i want to say something like
 $myvar$othervar .(but obviously that wont work) anyone have  a clue? i
tried
 using eval but i couldn't get it right




 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]