0

I'm struggling with something basic here. Can someone explain why I can't call this function and display the code in the browser? The code will output fine when not inside the function.

I'm getting the data from a curl call and using json.I

<?php
curl_setopt_array($curl, array(
// curl info
));
$response = curl_exec($curl);
curl_close($curl);
$data = json_decode($response,true);

function person() {
    foreach($data['Appointments'] as $person){
    echo "<span>" . $person['FullName'] . "</span><br>";
    echo "<span>" . $person['DateTimeOfBirth'] . "</span><br>";
    }
 }

 person(); // call the function
?>
ultrarun
  • 274
  • 1
  • 13

0 Answers0