/    Sign up×
Community /Pin to ProfileBookmark

no line breaks?

is they anyway i can take away line breaks from text.. example.

Text:
This.
That.
The other.

What i want it to be:
This. That. The other.

to post a comment
PHP

6 Comments(s)

Copy linkTweet thisAlerts:
@nooor83Apr 09.2006 — do you mean that t's in a text file ??
Copy linkTweet thisAlerts:
@putnamehereauthorApr 09.2006 — no, i mean like if someone was to post something in a text area and they press enter, it would come out as

"text blah blah blah

tezt"

how do i get it to be

"text blah blah blah tezt"
Copy linkTweet thisAlerts:
@NogDogApr 09.2006 — $string = str_replace("n", " ", $string);
Copy linkTweet thisAlerts:
@putnamehereauthorApr 09.2006 — will this work when writeing to a file?

as i did try

$comment = str_replace("<br />", "", $comment);

but that only worked when desplying on a browser.
Copy linkTweet thisAlerts:
@SpectreReturnsApr 09.2006 — [code=php]$str = str_replace(array("r", "n", "<br />"), null, nl2br($str));[/code]
Copy linkTweet thisAlerts:
@NogDogApr 09.2006 — [code=php]$str = str_replace(array("r", "n", "<br />"), null, nl2br($str));[/code][/QUOTE]
I'd recommend a space (" ") rather than null, otherwise words will be butted together if there's no space before the linebreak.
×

Success!

Help @putnamehere spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.17,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...