473,406 Members | 2,356 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

CR/LFs eaten by PHP !?

Env.: PHP 4.4.0 / IIS 5.1 / XP Pro

Hi All,

I'm writing a PHP page which contains plain text.
Oddly enough, it there is a CRLF right after a php tag, this CRLF is eaten
and doesn't appear on the client side.

e.g.:
<?php header('Content-type: text/plain') ?>
a:<?php whatever(); ?>
b:123
c:456

This script appear at the client as:
a:whateverb:123
c:456

instead of :

a:whatever
b:123
c:456

I noticed that adding a 2nd CRLF is a workaround since one CRLF then appears
at the client side. Adding any character (such as a space) between the php
tag and the crlf also preserves the CRLF.
However, I'd like to understand what happens. Is there a way to tell PHP to
preserve my CRLFs ?

TIA,

Serge
serge at wautier dot net
http://www.apptranslator.com
Oct 18 '05 #1
2 1636
Serge Wautier wrote:
Env.: PHP 4.4.0 / IIS 5.1 / XP Pro

Hi All,

I'm writing a PHP page which contains plain text.
Oddly enough, it there is a CRLF right after a php tag, this CRLF is eaten
and doesn't appear on the client side.

e.g.:
<?php header('Content-type: text/plain') ?>
a:<?php whatever(); ?>
b:123
c:456

This script appear at the client as:
a:whateverb:123
c:456

instead of :

a:whatever
b:123
c:456

I noticed that adding a 2nd CRLF is a workaround since one CRLF then appears
at the client side. Adding any character (such as a space) between the php
tag and the crlf also preserves the CRLF.
However, I'd like to understand what happens. Is there a way to tell PHP to
preserve my CRLFs ?


http://www.php.net/manual/en/faq.usi...using.newlines

--
Oli

Oct 18 '05 #2
Great ! thanks !

"Oli Filth" <ca***@olifilth.co.uk> wrote in message
news:11**********************@g43g2000cwa.googlegr oups.com...


http://www.php.net/manual/en/faq.usi...using.newlines

--
Oli

Oct 18 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: JS | last post by:
#include <ctype.h> double atof(char s){ double val, power; int i, sign; for (i = 0; isspace(s); i++) ; sign = (s == '-') ? -1 : 1; if (s == '+' || s == '-')
11
by: Howard Kaikow | last post by:
I'm using the code below, but an error is not getting trapped. Where can such errors occur? In another process? Try SomeCode Catch ex As Exception Dim strMsg() As String = Split(ex.ToString,...
0
by: dmitrey | last post by:
hi all, which way is the simplest for now to obtain the memory amount eaten by call to Python 'myfunc' function? Thx, D
6
by: Adrian | last post by:
How do I stop spaces from disappearing in an email I make up in an application? I found that \r\n has to be replaced by other characters, so presumably spaces have to be replaced as well: but by...
6
by: not_a_commie | last post by:
I changed the stdout in my C# app using Console.SetOut. It works fine for all my Console.Out.Write calls and with log4net. However, I don't see any output from native dlls that write to stdout....
6
by: (2b|!2b)==? | last post by:
I am expecting a string of this format: "id1:param1,param2;id2:param1,param2,param3;id" The tokens are seperated by semicolon ";" However each token is really a struct of the following...
2
by: CodecSmash49 | last post by:
im currently working on a assignment, where you have 3 monkeys that are feed for 7 days. You have to use a 2D array to gather the info. display like a chart, and find the average eaten each day. ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.