php strip trailing white space 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);
$string = str_replace(' ', '', $string);
$string = "this is my string"
$string = preg_replace('/\s+/', '', $string);