php code

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
mudradi.mohan
Forum Newbie
Posts: 1
Joined: Fri Mar 13, 2009 5:39 am

php code

Post 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
Mark Baker
Forum Regular
Posts: 710
Joined: Thu Oct 30, 2008 6:24 pm

Re: php code

Post 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>
Post Reply