I think is problem may be more connected to HTML rather then php.

The issue I have is that I have a my sql db and in one of the colume in which there is a string like:

Testing    1    2   3

but when I extract the variable all I see is :

Testing 1 2 3

I also tried to use the "htmlspecialchars" command but it wont do anything so if you have any suggestions how the problem may be fixed please post.

Recommended Answers

All 3 Replies

Have you tested to see if htmlspecialchars() converts spaces to   ?

If it doesn't you can try htmlentities()

It may also be faster to just use a string replace.

$str = str_replace(' ', ' ', $str);

Thanks
That helps a lot..

No problem, it's supposed to work like that ;-)

HTML for whatever reason condenses multiple spaces into one. To get it to keep its spacing (for an ASCII drawing or whatnot) use the < PRE > and < /PRE > tags (no spaces.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.