LMSouq
php-dev Open

Remove new lines from string and replace with one empty space

JA
James
1 month ago
3 views
Problem Description
$string = " put returns between paragraphs for linebreak add 2 spaces at end "; Want to remove all new lines from string. I've this regex, it can catch all of them, the problem is I don't know with which function should I use it. /\r\n|\r|\n/ `$string` should become: $string = "put returns between paragraphs for linebreak add 2 spaces at end ";

AI-Generated Solution

Powered by LMSouq AI · GPT-4.1-mini

✓ Solution Ready
Analyzing problem and generating solution…
Was this solution helpful?
Back to Knowledge Base