help for html spaces..

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
BRk
Forum Newbie
Posts: 6
Joined: Sat Jul 26, 2003 3:02 pm

help for html spaces..

Post by BRk »

Does anyone know a function or other way in php to display strings with spaces and line returns,in html code ?¿
thAnkS! :lol:
User avatar
trollll
Forum Contributor
Posts: 181
Joined: Tue Jun 10, 2003 11:56 pm
Location: Round Rock, TX
Contact:

Post by trollll »

Well, for line breaks you should check out this function in the php manual. You may want to just bookmark the manual, I did the first time I saw it and use it at least daily.
BRk
Forum Newbie
Posts: 6
Joined: Sat Jul 26, 2003 3:02 pm

thanks !

Post by BRk »

I just bookmart it ! thanks! U just save me from doing stupid and hard work, the thing is do you have a way of doing the same thing but with spaces ??
If not , thanks anyway.. :)
ThAnKs trollll !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
derek
Forum Newbie
Posts: 17
Joined: Sat Aug 16, 2003 11:31 am

Post by derek »

1)If you talk about HTML then you can use <br> tag

2) And in PHP you can use nl2br() to inserts a break. But remember don't use nl2br() if you want to save data in a database.
User avatar
Wayne
Forum Contributor
Posts: 339
Joined: Wed Jun 05, 2002 10:59 am

Post by Wayne »

for the spaces ....

str_replace(" " , "&nbsp;", $str);
Last edited by Wayne on Mon Aug 18, 2003 9:27 am, edited 3 times in total.
m3rajk
DevNet Resident
Posts: 1191
Joined: Mon Jun 02, 2003 3:37 pm

Post by m3rajk »

trollll wrote:Well, for line breaks you should check out this function in the php manual. You may want to just bookmark the manual, I did the first time I saw it and use it at least daily.
php.net is the first place i went when wnating php. bookmarked that and find it the best ref when trying to find a function and found this place through them. it's beent he best with getting help
Post Reply