how to remove line breaks using php code

how to remove line breaks?
how to remove carriage return and line feeds?
convert content in continuous line

When you are working with the php and export the data in the excel file or export to csv file then you will separate it with the \t and \n for the new lines, now if there is description or content which is text fields then its contains the HTML tags, line breaks and tabs. if you not remove this then it will not export proper data in the excel file, so its necessary to remove the line breaks from the content.

$data = trim(preg_replace('/\s+/','',strip_tags($data)));  

Using above code you get content in continuous line without line break and html code.