Page 1 of 1

Variable with variable value

Posted: Fri Jun 23, 2006 9:36 am
by tecktalkcm0391
Is there a way to make a variable be like this:

say $x = 3
so I want the variable to be $3_sc
and if $x=2
it would make the variable $2_sc

I am just wondering thanks
Thanks

Posted: Fri Jun 23, 2006 9:38 am
by Grim...
Yup, but a variable can't start with a number.

Code: Select all

$bob_whatever = "hello!";
$x = "bob";
$x .= "_whatever";
echo $$x;
//outputs hello!

Posted: Fri Jun 23, 2006 9:42 am
by tecktalkcm0391
Cool. Iknow about the number thing but didn't think about it in my example.