lundi 21 septembre 2020

get correct data from array

i am trying to decode array. this is my array

array:4 [▼
  "_token" => "tgPAddbrf3hI5tBIQIGyFYe9Y5RpwCj3rpZG5uVf"
  "resident_id" => array:4 [▼
    117 => "117"
    114 => "114"
    116 => "116"
    118 => "118"
  ]
  "available" => array:1 [▼
    116 => "2020-09-22"
  ]
  "out_of_community" => array:1 [▼
    118 => "2020-09-22"
  ]
]

i am using foeach to get answer like

resident_id  available    out_of_community
116         "2020-09-22"  null
118           null        "2020-09-22"

is it possible from foreach. my code for it

foreach ($data as $key => $value) {
            $data['resident_id'] = $key;
            
            # code...
        }


from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2ZXZqZD
via IFTTT

Aucun commentaire:

Enregistrer un commentaire