Okay, probably an easy solution, but I've given up. I want to set a variable with a variable and print it in PHP. I just can't get the syntax right. As an example:
$place["t"] = "T";
$norm_t = array("4","7");
I want to use this in a for-loop. How do I echo the first number of the norm_t array???
I've tried:
foreach ($place as $id => $name) {
#so id is now t.
echo "$norm_{$id}[0]"
}
# This doesn't seem to work. I want to echo the variable $norm_t using the "id" variable. I'm new to php and can think of how this is done in other languages, but the proper syntax for php eludes me.
I don't think you can construct the names of a variable in PHP by treating the variable name as a string and concatenating two variables names together as you are trying to do. One way to do it in PHP would be to define norm_t as a two dimensional array.
Note: I could be wrong, but I have not seen this (as you are trying to do) and I look at a lot of PHP code every week!
PS: You are missing a ";" in your code (syntax error)