faqts : Computers : Programming : Languages : PHP : kms : General : Variables

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

7 of 9 people (78%) answered Yes
Recently 7 of 9 people (78%) answered Yes

Entry

It is possible to dynamically build variable names from other variables?

Jul 16th, 2001 11:53
Rich Cavanaugh, Jeff G,


Yes.
<?php
	$myvar = 'vartwo';
	$$myvar = 'Variable Variable';
	echo $vartwo . "\n";
	echo $myvar . "\n";
?>
would output:
Variable Variable
vartwo
You may also want to take a look at 
http://php.net/manual/en/language.variables.variable.php