get("fs_horario($periodo, $carrera, '$grupo', true)"); // get each id from $horarios (might be duplicate) try { $horarios = array_map(function ($horario) use ($dias, $db) { $horario['profesores'] = array_map( fn ($profesor) => $db->where("id", $profesor)->getOne("fs_profesor"), explode(",", substr($horario['profesores'], 1, -1)) ); $horario['dia'] = $dias[$horario['dia']]; return $horario; }, $horarios); } catch (Exception $e) { die(json_encode([ "status" => "error", "message" => $e->getMessage(), ])); } ?> "success", "horario" => $horarios, ]) ?>