Hello all, I need a help for str_replace. I want to know which one is for " ". ( I mean which one of them "\r\n","|","\n","\\r\\n","\\n" is for the space. Here is my code $to_replace = array("\r\n","|","\n","\\r\\n","\\n"); $title = str_replace($to_replace, " ", $title); $title1 = str_replace($to_replace, "_", $title); $description = str_replace($to_replace, " ", $description); $query="INSERT INTO `filedetails` VALUES ('', '".$type."', '".$title."', '".$title1."', '".$description."', '".$links."','0000000000')"; Code (markup): I am trying to add "_" instead of " " for title1 field. I hope you understood what i mean. Thanks
So, you want to replace the spaces in a string with underscores, correct? str_replace(" ", "_", $string);
Or just add the space to your $to_replace: $to_replace = array("\r\n","|","\n","\\r\\n","\\n"," "); PHP: