By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,303 Members | 1,260 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,303 IT Pros & Developers. It's quick & easy.

variable variables

P: 3
Hi Guys

This is an example of the use of variable variables:
Does this example look correct???

$myvar = "numbers";
$$myvar = array(1,2,3,4);
echo "<p>Varname:" .$myvar. "</p>";
echo "<p>Value:" .$$myvar. "</p>";
echo "<p>Item:". $numbers[1]. "</p>";
Feb 19 '08 #1
Share this Question
Share on Google+
1 Reply


MarkoKlacar
Expert 100+
P: 296
Hi Guys

This is an example of the use of variable variables:
Does this example look correct???

$myvar = "numbers";
$$myvar = array(1,2,3,4);
echo "<p>Varname:" .$myvar. "</p>";
echo "<p>Value:" .$$myvar. "</p>";
echo "<p>Item:". $numbers[1]. "</p>";
Hi,

Looks ok to me, are you new to PHP?
Feb 19 '08 #2

Post your reply

Sign in to post your reply or Sign up for a free account.