View Full Version : How to stop a space showing up after an echo?

08-11-2007, 10:27 AM
<? $test = "Hello"; ?>

Richard says <? echo $test; ?>.

This is just an example of a larger script, but when executed in the browser, the end result is this:

Richard says Hello .

Why is there always a space between the script and whatever follows it, even though there's no space between the closing bracket and period in the script itself? How do you stop it doing that?

08-11-2007, 11:45 AM
Ok, well I'm not sure about you, but there is no problem with that script, I ran it and it came out "Richard says Hello." no space after the echo, have you actually checked if the variable set on the larger script has a space after it? And I would suggest that you change the <? to <?php but other than that, no problem..

08-11-2007, 12:17 PM
If you use this:

Richard says <? echo trim( $test ); ?>.

Does the space still exists?