php clear trailing white space code example
Example 1: remove empty spaces php
$string = str_replace(' ', '', $string);
Example 2: remove space from start and end of string in php
$trimmed = trim($text);
var_dump($trimmed);
$string = str_replace(' ', '', $string);
$trimmed = trim($text);
var_dump($trimmed);