Jump to content

Multiple lines


stuffradio

Recommended Posts

let me rephrase my answer

 

str_replace( "\r\n", "\\n", $content );

 

Ok, ok, I'll elaborate.

 

multiple lines in javascript look like

 

document.write('Hello\nThis is the Second Line');

 

So if you have a bunch of content generated by a php page, this is what you'd have to do:

 

<?php

$content = "hello
this is the second line.";

$content = str_replace( "\r\n", "\\n", $content );

print '
<script type="text/javascript">
document.write("' . $content . '");
</script>';

?>

Link to comment
https://forums.phpfreaks.com/topic/167225-multiple-lines/#findComment-881717
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.