0

I want when the user enters his/her username such as my username is in the username field, my php code changes it to such a thing : myusernameis . How is possible this action?

java
  • 149
  • 1
  • 9

1 Answers1

1

You can achieve this by two way.

First Way using str_replace

$string = str_replace(' ', '', $string);

Second Way using preg_replace

$string = preg_replace('/\s+/', '', $string);