Re: Windows PHP 5.2.6 - Problems with Escape Characters
Thank you all very much.
Yep I was testing through the browser, your suggetions worked.
Thanks again.
Windows PHP 5.2.6 - Problems with Escape Characters
Collapse
This topic is closed.
X
X
-
Guest replied -
Guest repliedRe: Windows PHP 5.2.6 - Problems with Escape Characters
scopnd@gmail.co m wrote:Hi,
>
I'm new to PHP and I am working through tutorials. I am running PHP
5.2.6, on windows xp. I am having problem with escape characters, they
do not seem to work. The below code example should display on multiple
lines, it just displays on 1 line no '\n' line breaks, it's ignored.
Is there something I need to set in the php.ini file? The php seems to
be installed fine as I can call functions etc.
>
<?php
$text = "A very long woooooooooooord .";
$newtext = wordwrap($text, 8, "\n", true);
>
echo "$newtext\n ";
?>
>
>
Thanks
>
Ned
try
echo "<pre>$newtext\ n</pre>";
browsers may not treat \n as <brunless it is within the <pretags.
Leave a comment:
-
Guest repliedRe: Windows PHP 5.2.6 - Problems with Escape Characters
scopnd@gmail.co m a écrit :Are you trying it through your browser ? Cause then, it displays asThe below code example should display on multiple
lines, it just displays on 1 line no '\n' line breaks, it's ignored.
Is there something I need to set in the php.ini file? The php seems to
be installed fine as I can call functions etc.
>
<?php
$text = "A very long woooooooooooord .";
$newtext = wordwrap($text, 8, "\n", true);
>
echo "$newtext\n ";
?>
expected in the source code only, while your browser doesn't handle
newlines and display all lines concatenated.
You can easily change it by echoing nl2br("{$newtex t}\n"); (I prefer
using curly brackets into double-quoted strings)
Regards,
--
Guillaume
Leave a comment:
-
Windows PHP 5.2.6 - Problems with Escape Characters
Hi,
I'm new to PHP and I am working through tutorials. I am running PHP
5.2.6, on windows xp. I am having problem with escape characters, they
do not seem to work. The below code example should display on multiple
lines, it just displays on 1 line no '\n' line breaks, it's ignored.
Is there something I need to set in the php.ini file? The php seems to
be installed fine as I can call functions etc.
<?php
$text = "A very long woooooooooooord .";
$newtext = wordwrap($text, 8, "\n", true);
echo "$newtext\n ";
?>
Thanks
Ned
Tags: None
Leave a comment: