space
Moderator: General Moderators
Like this?
Code: Select all
<?php
$result = count_chars("You mean something like this?",0);
// 32 being the code for space...
echo $result[32]; // returns 10
?>That's because by default anything beyond ' ' will be removed.. So what you can do is add this right before you insert it:
This will modify it so that all those spaces and changed into &*nbsp; which is a space, but it doesn't get removed.
Be sure to remove the star between "&" and "nbsp;" i added it so that it was visible
Code: Select all
$_POST['text'] = str_replace(" ","&*nbsp;",$_POST['text']);Be sure to remove the star between "&" and "nbsp;" i added it so that it was visible
If there are more spaces than normal, I might try either wordwrap or something like:
But then again, I've never tried it..
Code: Select all
str_replace(" ", " &*nbsp;", $string);trim will only strip whitespace from the begining and end of a string.
http://se.php.net/manual/en/function.trim.php
Mark
http://se.php.net/manual/en/function.trim.php
Mark
