Hello, I've started back into my game project. Right now I'm facing an issue between php, js, and mysql. I have room descriptions as text field in mysql. They have paragraphs right the field, copied from text editor to mysql. When I var_dump the return html I see a line for each paragraph out of mysql. issue image https://ibb.co/WWHj0bc When I run this line of code to clean white spaces, not what I want to do, it still json_encode's wrong: $returnValue['html'] = '<h2>'.$returnValue['roomData']['name'].'</h2><p>'.trim(preg_replace( "/[\\x00-\\x19]+/" , '' , $returnValue['roomData']['description'])).'</p>'; Code (markup): I really want to preserve my paragraphs. I think it's json encoding wrong because I just alert blank in JS instead of [Object][object] or whatever it is. See my awesome game window https://ibb.co/2tSDH3d
Uh, this thread can be marked for deletion. I found the issue. A hidden typo in another location. Sorry for inconvenience here.
Just a silly question on my part... [\\x00-\\x19]+ Why are you deleting ALL control characters? I'm just curious the reasoning of using that over \s.