Good Afternoon,

I have this line of code:

echo $sum;

Earlier in my page, I have set a variable to:

$wk="wk1";

What is the syntax to use the Variable $wk instead of spelling out wk1.

I want to be able to change $wk once and have it change throughout a number of pages.

Thanks
Chris

It's been a while since I worked with PHP, but I'm sure you can just put the variable directly in the braces.

echo $sum[$wk];

If you need the rest of the string that you have entered, change the single-quotes to double-quotes. PHP will resolve a variable that's contained within double-quotes.

echo $sum["PTS1011_$wk"];

commented: Thank you! +1