The function trim()
removes only the spaces (and control characters such as \n) from the beginning and the end of the string.
$title = str_replace(" ", "", trim($title));
$user = str_replace(" ", "", trim($user));
I just wanted to attack the problem. So, the solution may look bad. Anyways, the best use for this is by using this way:
$title = str_replace(" ", "", $title);
$user = str_replace(" ", "", $user);
I removed the trim()
function because str_replace()
does the job of trim()
.