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?
Asked
Active
Viewed 13 times
0

java
- 149
- 1
- 9
-
1Well post your php code so we can see what's going wrong. – Daan Jul 23 '15 at 09:35
-
`$yourusername = preg_replace('/\s+/', '', $yourusername );` – Amani Ben Azzouz Jul 23 '15 at 09:36
1 Answers
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);

William Francis Gomes
- 561
- 1
- 7
- 29