It should generate an array in your $_POST
or $_GET
superglobal just like any other PHP array, you can iterate over it like this:
foreach($_POST['question_'] as $question_id => $answer) {
echo 'Answer for Question #' . $question_id . ' is: ' . $answer . PHP_EOL;
}
Edit: This example is following your first line of code - the second block of code is different and would not be produced by looping the first. You should definitely use the first style not the second, as arrays are much easier to loop over in this scenario than an arbitrary number of elements named like question_1
, question_2
etc.