Solution (source code)

= Solution

The <Euler-Lagrange equation> is
$$
\boxed{\phi_{tt}-\phi_{xx}+U'(\phi)=0}.
$$
Time-translation invariance gives the conserved energy
$$
\boxed{E=\int_{\mathbb R}\left[\frac12\phi_t^2+\frac12\phi_x^2+U(\phi)\right]dx}.
$$
Indeed, after integrating the spatial term by parts and imposing finite-energy boundary conditions,
$$
\frac{dE}{dt}
=\int_{\mathbb R}\phi_t(\phi_{tt}-\phi_{xx}+U'(\phi))\,dx=0.
$$