<html>
<body>
$x = " Hello World! ";
echo trim($x);
<p>The whitespaces are invisible in plain HTML,<br>
but check out the difference in two input fields:</p>
echo "<input value='" . $x . "'>";
echo "<br>";
echo "<input value='" . trim($x) . "'>";
</body>
</html>
The whitespaces are invisible in plain HTML,
but check out the difference in two input fields: