I pass my function an object that contains some answers. I then do the following to create an associative array
$field_data = array();
foreach($submission->answers as $answer) {
$field_data[$answer->question_id] = $answer->text + 1;
}
This results in array like so
array:15 [▼
1 => 3
2 => 4
3 => 2
4 => 5
]
What I need to do is build an API call using the above data. The API URL would look something like this
someAPI.com?api.php?function=calculatePrice&question1=3&question2=4&question3=2&question4=5
Where the question number is the value on the left side of the array, and the part after the = sign is the value on the right of the array.
What would be the best way to create this URL using the array I have?
Thanks