JSON TO PHP ARRAY READ DATA [duplicate]

i’m very new to php,json and array.

i decode the json to array with $obj=json_decode($data,true);

the json is:

{
   "events":[
      {
         "id":"3433333",
         "appointment":{
            "id":"12907641",
            "start_date":"2022-10-28T11:20:00+02:00",
            "end_date":"2022-10-28T11:40:00+02:00",
            "duration":20,
            "status":"confirmed",
            "notes":null,
            "agenda_id":"11",
            "agenda_label":"AAAAA",
            "visit_motive_id":"111",
            "visit_motive_label":"BBBBBBB",
            "patient":{
               "id":"32621033",
               "last_name":"Pluto",
               "first_name":"Giovanni",
               "maiden_name":null,
               "gender":null,
               "birthdate":"1988-02-01",
               "phone_number":"+xxxxxxxxxxxxxx",
               "secondary_phone_number":"+xxxxxxxxxxxxx",
               "email":"[email protected]",
               "address":null,
               "zipcode":null,
               "city":null
            }
         }
      }
   ]
}

i need to read the events id and all the appointment data and the patient data.

i tryed with:

$fl = $obj['events']['id'];

and with

$fr = $obj['events']['appointment']['id'];

but it is wrong.

Any help will be very appreciated

Thank you