How can I output a string with it's newline characters visible in php? -
i have string newlines i'd print out see special chars (such \n) rather newlines themselves.
so string typically echo'd
this top line of string second line of string would instead this:
this top line of string\nthis second line of string how accomplish in php?
try this:
<?php $string = "this top line of string second line of string"; echo json_encode($string); ?>
Comments
Post a Comment