Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Append 2 variable names to form one variable

Status
Not open for further replies.

axtec

Programmer
Dec 12, 2001
21
0
0
US
If I have a variable named '$Day1', and a variable named $sequence, how can I get the value of $Day1 using $sequence instead of the number 1? i.e. $Day$sequence? Thanks.
 
I don't see why you wouldn't want to use arrays, after all they are meant to allow easy indexed accessing.

But you can use this:

$temp = "Day";
$temp .= $sequence;

the variabele you want is $$temp

(notice the double-dollarsign syntax)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top