<?php
$arr = [
"name" => [
1 => [
1 => "Jake" // name of the participant being registered in the registration_type_id "1"
],
4 => [
1 => "John" // name of the participant being registered in the registration_type_id "4"
],
],
"surname" => [
1 => [
1 => "K" // surname of the participant being registered in the registration_type_id "1"
],
4 => [
1 => "W" // surname of the participant being registered in the registration_type_id "4"
],
],
"answer" => [
1 => [
1 => [ // this array stores the answers for the participant being registered in the registration_type_id "1"
1 => "answer1", // for question_id "1" the user that is doing the registration answered "answer1"
2 => "answer2", // for question_id "2" the user that is doing the registration answered "answer2"
],
],
],
];
foreach($arr['answer'] as $key => $value)
{
foreach($value[1] as $id => $response)
echo "ID: $id\nResponse: $response\n";
}
PD9waHAKCiRhcnIgPSBbCiAgICAibmFtZSIgPT4gWwogICAgICAgIDEgPT4gWwogICAgICAgICAgICAxID0+ICJKYWtlIiAgLy8gbmFtZSBvZiB0aGUgcGFydGljaXBhbnQgYmVpbmcgcmVnaXN0ZXJlZCBpbiB0aGUgcmVnaXN0cmF0aW9uX3R5cGVfaWQgIjEiCiAgICAgICAgXSwKICAgICAgICA0ID0+IFsKICAgICAgICAgICAgMSA9PiAiSm9obiIgIC8vIG5hbWUgb2YgdGhlIHBhcnRpY2lwYW50IGJlaW5nIHJlZ2lzdGVyZWQgaW4gdGhlIHJlZ2lzdHJhdGlvbl90eXBlX2lkICI0IgogICAgICAgIF0sCiAgICBdLAogICAgInN1cm5hbWUiID0+IFsKICAgICAgICAxID0+IFsKICAgICAgICAgICAgMSA9PiAiSyIgICAgICAvLyBzdXJuYW1lIG9mIHRoZSBwYXJ0aWNpcGFudCBiZWluZyByZWdpc3RlcmVkIGluIHRoZSByZWdpc3RyYXRpb25fdHlwZV9pZCAiMSIKICAgICAgICBdLAogICAgICAgIDQgPT4gWwogICAgICAgICAgICAxID0+ICJXIiAgIC8vIHN1cm5hbWUgb2YgdGhlIHBhcnRpY2lwYW50IGJlaW5nIHJlZ2lzdGVyZWQgaW4gdGhlIHJlZ2lzdHJhdGlvbl90eXBlX2l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