$id))[0]; $data = json_decode($vehicle['sampledata'], true); $count = 1; foreach ($data as $d) { if ($d['important'] === "1") { $imp = 'required'; } echo '