Do you have a question? Post it now! No Registration Necessary. Now with pictures!
- Posted on
May 15, 2008, 12:50 pm
rate this thread
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.
$text = "A very long woooooooooooord.";
$newtext = wordwrap($text, 8, "\n", true);
Re: Windows PHP 5.2.6 - Problems with Escape Characters
Are you trying it through your browser ? Cause then, it displays as
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("\n"); (I prefer
using curly brackets into double-quoted strings)