# convergence in measure implies the composition of the sequence of functions and a continuous function also converges in measure

Let $D$ be a measureble set in $\mathbb{R}^n$. Suppose $\mu(D)<\infty$. Let $\phi: D\times \mathbb{R}\to \mathbb{R}$ be a continuous function such that for almost every $x\in D$, $\phi_x(t)=\phi(x,t)$ is a continuous function of $t$, and for almost every $t\in\mathbb{R}$, $\phi_t(x)=\phi(x,t)$ is a measurable function of $x$. Let $\{f_n\}$ be a sequence of measurable functions on $D$ such that $\{f_n\}$ converges to $f$ in measure. Prove that $g_n(x)=\phi(x,f_n(x))$ converges to $g(x)=\phi(x,f(x))$ in measure.

I am quite confused and do not know how to solve......

The result will hold if we manage to show that if $n_k\uparrow\infty$, then we can extract from $(g_{n_k})_{k\geqslant 1}$ a subsequence $(g_{m_k})_{k\geqslant 1}$ such that $g_{m_k}\to g$ for almost every $x$.
To do that, we extract from $f_{n_k}$ a subsequence which converges almost everywhere to $f$.