Remove extra spaces from a string using PHP snippet

The preg_replace() function is an inbuilt function in PHP which is used to perform a regular expression for search and replace the content. You can use below snippet for replace extra blank space,new lines and tab from any string.

Live A Reply

0
    Product Price Quantity Total

Cart totals

Subtotal $0.00
Total $0.00