Continuous upper envelope of upper semicontinuous function

Let $u$ be a upper semicontinuous function on a compact set $K$ in $\mathbb R^d$. Define a space of continuous function dominating $u$ by $$A = \{\phi \in C(K): \phi \ge u\}.$$ [Q.] Is the following inequality true? $$\inf_{\phi \in A} \int_K (\phi - u) dx = 0?$$

It seems true, if $d = 1$. Indeed, one can simply take linear interpolation from each discontinuous point of $u$ to its small neighborhood. However, I do not have idea when $d\ge 2$. Does it related to the geometry of discontinuous set of $u$?

The equality is true, independently of $d$.
By Theorem 2.1.3 of Ransford's book "Potential theory in the complex plane", since $u$ is bounded above on the compact set $K$, there is a decreasing sequence of continuous functions $f_n$ that converge pointwise to $u$.
Then, by the monotone convergence theorem, $$\lim_n\int f_ndx=\int udx.$$
For any upper semi-continuous function $f \colon X \to [-\infty,+\infty)$ defined on a nonempty topological space $X$ there exists a nonempty set $\mathcal{F}\subset C(X,\mathbb{R})$ such that $f(x)=\inf\{g(x)\colon g \in \mathcal{F}\}$ for every $x \in X$. If $X$ is metrisable then $\mathcal{F}$ may be taken to be countable. These results can be found in chapter 9 of Bourbaki's General Topology. Your result follows by taking $(g_n)$ to be an enumeration of $\mathcal{F}$, defining $f_n:=\min_{1\leq k \leq n}g_k$, and applying the monotone convergence theorem to the sequence $(f_n)$ which decreases pointwise to $f$.