LMSouq
general-dev Open

Remove multiple whitespaces

CR
creativz
1 month ago
3 views
Problem Description
I'm getting `$row['message']` from a MySQL database and I need to remove all whitespace like `\n` `\t` and so on. $row['message'] = "This is a Text \n and so on \t Text text."; should be formatted to: $row['message'] = 'This is a Text and so on Text text.'; I tried: $ro = preg_replace('/\s\s+/', ' ',$row['message']); echo $ro; but it doesn't remove `\n` or `\t`, just single spaces. Can anyone tell me how to do that?

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