sneamia Posted July 29, 2008 Share Posted July 29, 2008 $_GET['user'] == NULL ? $GET['user'] = 'roflwaffle' : str_replace(' ', '_', strtolower($GET['user'])); str_replace does not seem to recognize spaces. It does not swap them for underscores, as it should. What am I doing wrong? Quote Link to comment https://forums.phpfreaks.com/topic/117092-solved-str_replace-with-spaces/ Share on other sites More sharing options...
.josh Posted July 29, 2008 Share Posted July 29, 2008 You wrote your ternary wrong. It should be $_GET['user'] = ($_GET['user'] == NULL) ? 'roflwaffle' : str_replace(' ', '_', strtolower($GET['user'])); Assuming that you were wanting to assign 'roflwaffle' to it if it's null, str_replace if not. Quote Link to comment https://forums.phpfreaks.com/topic/117092-solved-str_replace-with-spaces/#findComment-602237 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.