$clave, 'hora' => $hora, 'id' => $id ]]; } foreach ($claves as $horario) try { $profesor_id = $horario["clave"]; query("SELECT fi_registrar_asistencia(:id::INT, FALSE, ARRAY[ NOW(), :fecha::DATE + :hora::TIME ]::TIMESTAMP[], :profesor_id::INT, TRUE)", [ ":fecha" => $fecha->format('Y-m-d'), ":hora" => $horario["hora"], ":id" => $horario["id"], ":profesor_id" => $profesor_id ]); } catch (Exception $e) { die( json_encode(["error" => $e->getMessage()]) ); } die(json_encode(["success" => true]));