'Exported CSV Breaks When I Try Strip HTML Tags

I created my own custom function when exporting data on my Wordpress website. Whenever I strip the HTML tags it corrupts the CSV file. All columns are written in a single column or an extra column is formed.I couldn't figure out what was causing this.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source