fork download
  1. <?php
  2.  
  3. $arr = [
  4. "name" => [
  5. 1 => [
  6. 1 => "Jake" // name of the participant being registered in the registration_type_id "1"
  7. ],
  8. 4 => [
  9. 1 => "John" // name of the participant being registered in the registration_type_id "4"
  10. ],
  11. ],
  12. "surname" => [
  13. 1 => [
  14. 1 => "K" // surname of the participant being registered in the registration_type_id "1"
  15. ],
  16. 4 => [
  17. 1 => "W" // surname of the participant being registered in the registration_type_id "4"
  18. ],
  19. ],
  20. "answer" => [
  21. 1 => [
  22. 1 => [ // this array stores the answers for the participant being registered in the registration_type_id "1"
  23. 1 => "answer1", // for question_id "1" the user that is doing the registration answered "answer1"
  24. 2 => "answer2", // for question_id "2" the user that is doing the registration answered "answer2"
  25. ],
  26. ],
  27. ],
  28. ];
  29.  
  30.  
  31.  
  32. foreach($arr['answer'] as $key => $value)
  33. {
  34. foreach($value[1] as $id => $response)
  35. echo "ID: $id\nResponse: $response\n";
  36. }
Success #stdin #stdout 0.02s 23468KB
stdin
Standard input is empty
stdout
ID: 1
Response: answer1
ID: 2
Response: answer2