remove empty space before tags php wordpress code example
Example 1: remove empty spaces php
$string = str_replace(' ', '', $string);
Example 2: remove all spaces php
$string = "this is my string"
$string = preg_replace('/\s+/', '', $string);