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? 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. 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
Archived
This topic is now archived and is closed to further replies.