Get your own PHP server Result Size: 625 x 565
x
 
<!DOCTYPE html>
<html>
<body>
<?php
$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>
<?php
echo "<input value='" . $x . "'>";
echo "<br>";
echo "<input value='" . trim($x) . "'>";
?> 
</body>
</html>
Hello World!

The whitespaces are invisible in plain HTML,
but check out the difference in two input fields: