I could use some help better understanding how Arrays work, including "scope"...

When my Form is submitted, I am creating an array to hold Answers like this...
PHP Code:
    foreach($_POST['answerArray'] as $q => $a){
        
// Copy data from POST to PHP array.
        
$answerArray[$q] = trim($a); 

Shortly after populating the $answerArray, I need to iterate through it again, so I did this...
PHP Code:
    foreach($answerArray as $questionID => $answer){ 
Notice how I changed the variable names for fear that these two blocks of code would collide and blow up?!


Now I am at the bottom of my script, and I would like to access the $answerArray a 3rd time to dynamically build the Questions and Answers on my Form itself.


Questions:
1.) Can someone help me better understand the scope of the Array itself?

2.) Can someone help me better understand the scope of the Key and Value variables?

3.) Did I need to change the "Key" and "Value" variable names between the two blocks of code above?

4.) What do I need to do for this 3rd use of the Array when I try to dynamically create my Form Fields?

Hope that makes senses?!

Thanks,


Debbie