I have a PHP Script that users will enter a name like: Alex_Newton,
Alex_Newton
However, some users will use a space rather than an underscore, so my question is:>
As of others have explained how to do it using str_replace, you can also use regex to achieve this.
str_replace
$name = preg_replace('/\s+/', '_', $name);