Tips & Tutorials – PHP

3 Ways To Remove Line Breaks In PHP (Simple Examples)

Welcome to a quick tutorial on how to remove line breaks in PHP. Need to get rid of all line breaks from a string? Remove some extra ones? The common ways to remove line breaks in PHP are: $nobreak = str_replace([“\r”, “\n”], “”, $STRING); $nobreak = preg_replace(“/\r|\n/”, “”, $STRING); $nobreak = trim($STRING); That should cover …

3 Ways To Remove Line Breaks In PHP (Simple Examples) Read More »