PHP & how to trim white space on beginning and the end of each new line with September 17, 2017 September 17, 2017 $text = join("\n", array_map("trim", explode("\n", $text))); Share this:Click to share on Twitter (Opens in new window)Click to email a link to a friend (Opens in new window)Like this:Like Loading... Related Previous PostPHP easiest color swap for rows Next PostPHP & how to trim, replace tabs and extra spaces with single spaces