473,383 Members | 1,837 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,383 software developers and data experts.

header questions

I'm having some trouble wrapping my mind around header(), I'm used to
just printing the header and leaving a blank line.

Does php ignore whitespace before a header:

<?php

// no output here
?>

just whitespace, are the line feeds ignored?

<?php
header(...)...

Also, I take it that we can have multiple header functions. If I now
echo something or just have embedded html, I take that php inserts a
blank line and the header is finished?

Why can't I just echo the headers and not use header?

Jeff
Sep 28 '08 #1
5 2127
Jeff wrote:
I'm having some trouble wrapping my mind around header(), I'm used to
just printing the header and leaving a blank line.

Does php ignore whitespace before a header:

<?php

// no output here
?>

just whitespace, are the line feeds ignored?
Yes, PHP ignores whitespace.
<?php
header(...)...

Also, I take it that we can have multiple header functions. If I now
echo something or just have embedded html, I take that php inserts a
blank line and the header is finished?
No, PHP does not insert a blank line. It inserts whatever you echo.
However, ANY output causes the headers to be sent and the data portion
to begin.
Why can't I just echo the headers and not use header?

Jeff
Because headers are headers and all the rest is data. Two entirely
different things.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================

Sep 28 '08 #2
"Jeff" <jeff@spam_me_not.comschreef in bericht
news:Pd******************************@earthlink.co m...
I'm having some trouble wrapping my mind around header(), I'm used to
just printing the header and leaving a blank line.

Does php ignore whitespace before a header:

<?php

// no output here
?>

just whitespace, are the line feeds ignored?

<?php
header(...)...

Be careful.

This does contain output between the two php lines which is not ignored.
---snip---
<?php $a=1; ?>

<?php header('whatever'); ?>
---snip---

The following is OK:
---snip---
<?php $a=1; ?>
<?php header('whatever'); ?>
---snip---

Sep 28 '08 #3
mijn naam wrote:
"Jeff" <jeff@spam_me_not.comschreef in bericht
news:Pd******************************@earthlink.co m...
> I'm having some trouble wrapping my mind around header(), I'm used
to just printing the header and leaving a blank line.

Does php ignore whitespace before a header:

<?php

// no output here
?>

just whitespace, are the line feeds ignored?

<?php
header(...)...


Be careful.

This does contain output between the two php lines which is not ignored.
---snip---
<?php $a=1; ?>

<?php header('whatever'); ?>
---snip---

The following is OK:
---snip---
<?php $a=1; ?>
<?php header('whatever'); ?>
---snip---

But that is html, not PHP code.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attglobal.net
==================

Sep 28 '08 #4
"Jerry Stuckle" <js*******@attglobal.netschreef in bericht
news:gb**********@registered.motzarella.org...
>>Does php ignore whitespace before a header:

<?php

// no output here
?>

just whitespace, are the line feeds ignored?

<?php
header(...)...
But that is html, not PHP code.
Indeed it is.

The short answer to the question would be: "no".

Sep 28 '08 #5
I'm having some trouble wrapping my mind around header(), I'm used to
>just printing the header and leaving a blank line.

Does php ignore whitespace before a header:
^^^^^^ PHP does *not* ignore the whitespace here.
><?php
^^^^^^ but it ignores the whitespace here
>// no output here
?>
^^^^^^ and it does *not* ignore the whitespace here either.
>just whitespace, are the line feeds ignored?

<?php
header(...)...

Also, I take it that we can have multiple header functions. If I now
echo something or just have embedded html, I take that php inserts a
blank line and the header is finished?

Why can't I just echo the headers and not use header?

Jeff

Sep 28 '08 #6

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

Similar topics

21
by: Hattuari | last post by:
I'm learning C++ after having spent several years in the computer industry doing both system administration and engineering. I've written code in Perl, Bash, Pascal, Ada, C, Mathematica (hundreds...
31
by: Steven T. Hatton | last post by:
If a header is not necessarily a source file, and the sequences delimited by < and > in header names aren't necessarily valid source file names, what exactly is a header? -- p->m == (*p).m == p.m...
11
by: Steven T. Hatton | last post by:
In the past there have been lengthy discussiions regarding the role of header files in C++. People have been very adamat about header files serving as in interface to the implementation. I do...
5
by: Jim Holder | last post by:
I tried building libpcap and tcpdump from my Red Hat 7 RPMs. The tcpdump make couldn't find ioccom.h and sockio.h. When a header file is missing, how do you find it? Thanks.
8
by: ginnisharma1 | last post by:
Hi All, I am very new to C language and I got really big assignment in my work.I am wondering if anyone can help me.........I need to port compiler from unix to windows and compiler is written...
3
by: fc2004 | last post by:
Hi, Is there any tools that could report where cyclic header dependency happens? this would be useful when working with a large project where tens or hundreds of headers files may form complex...
4
by: Christoph Scholtes | last post by:
Hi, I have some questions about header files: Say I have a file functions.c which contains a couple of functions. I have declared some structs in this file too. The structs are defined in...
16
by: wdh3rd | last post by:
Hi everyone. I'm new to C and I have a few questions: I am making files for permutations and combinations. Files to be made are perm.c, perm.h, combo.c, and combo.h. Since both combinations...
4
by: andre rodier | last post by:
Hello, I need to display or propose a jpeg image on a web page. When I need to display the image, I use this code : header("Content-Length: $fileSize") ; header("Content-Type: $type") ;...
1
by: RN1 | last post by:
Consider the following DataGrid: -------------------------------------------------------------------------------- <asp:DataGrid ID="dgMarks" AutoGenerateColumns="false" runat="server"> <Columns>...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.