I have an array, anArray, that I loop through, like so:
foreach ($anArray as $key) {
echo $_GET[$key];
}
I get numerous errors saying:
Undefined index: $key
Which is true, but I don't know how to get my PHP to recognise $key is a variable, and not just a string.
If I print out the list of the $_GET $key => $value pairs, and a list of $anArray, they both contain at least some of the same values.
Can anyone tell me where I'm going wrong?
Many thanks.
$arr[$var]is supported perfectly fine.