I'm dynamically declaring variables using the following code:
$fields = array('name1', 'name2');
foreach($fields as $field) {
$$field = false;
}
The problem is there are variable names that overlap, since I'm using more than one array.
The question is: How could I append a letter to the variable name using the previous method?
For example if we were to append the letter F to the previous example, then we'd get $Fname1, $Fname2.
I tried to do $F$field but that doen't work, I also tried to set $field = "F"+$field inside the loop but didn't work either.
$fieldSet = array_fill_keys($fields, false);.... but if you have duplicate variable names, then you're certainly approaching this the wrong way