Page 1 of 1

php code

Posted: Fri Mar 13, 2009 5:47 am
by mudradi.mohan
Hello,

I have an array consisting of some elements, Some elements are being seperated with 3 spaces in between like 'new folder'(3 spaces are there in between). When I display the array elements on the screen, it displays me correctly. But when I display the same thing on the browser, it displays only one space instead of three. Can any one please post a solution for this? What do I need to do in order to display the spaces as it is?

Thanks and regards,
Mohan

Re: php code

Posted: Fri Mar 13, 2009 5:56 am
by Mark Baker
This isn't a PHP problem, it's the way browsers work: they always compress multiple "white space" characters down to a single space.

You can, however, wrap your output in <pre> tags, which will retain the spaces

Code: Select all

<pre>This  is   a    set     of      spaces</pre>