iNET Interactive - Online Advertising Agency
          
   Home    Authors    About    Login    Contact Us
   Search:   
Advanced Search     
  Articles

  ASP (26)
  ASP.NET (19)
  C and C++ (4)
  CFML (2)
  CGI and Perl (16)
  Flash (2)
  Java (7)
  JavaScript (28)
  PHP (92)
  MySQL (13)
  MSSQL (3)
  HTML (34)
  SEO (9)
  Visual Basic (12)
  CSS (13)
  SSI (5)
  XML (12)
  C# (14)

  Developer News

May 13, 2008
MySpace Profile Page Resources
HTML Goodies
 
May 13, 2008
How to Upload Your Photos onto the Web
HTML Goodies
 
May 13, 2008
Email Marketing for MySpace Artists
HTML Goodies
 
May 13, 2008
Top Online Marketing Techniques
HTML Goodies
 
May 13, 2008
I want to create a site just like ____, is that a violation of...
About
 
May 12, 2008
Film Makers, Bands and Comedians Welcome on MySpace
About
 
Courtesy of moreover.com
 
Want to receive new articles via e-mail? Click here!
/Home /PHP /Introduction to PHP

PHP Lesson One - Entry Point 

  Views:    29845
  Votes:    5
by James N Hitz 1/23/04 Rating: 

Synopsis:

Lesson 1: introduces the PHP basics outlining PHP strengths, weaknesses and also where to get PHP.
Pages: firstback1 2 3 4 5 6 7 8 forwardlast
The Article

Enter the "Here Document"

There is a PHP feature called the HERE document (Again I can't get to terms with why they called it the HERE document. What kinda' name is that anywayz?) HERE it is though! This HERE document allows the user to produce output without escaping. This is how it works:

You specify a start line. This is done by putting three less than signs and a LABEL. The LABEL is then followed by all your un-escaped (normal) text (read HTML), and then the LABEL again (This time without the three less thans). This LABEL can be anything you choose for as long it is NOT a PHP reserved word. In our example below we use the label OUTPUT:

  
print <<<OUTPUT
<html><head></head><body bgcolor="black" text="white">
<h2 align="right">Heading here
All your Other Unescaped Text comes here....
... and it can be veeeeeeeeeeeeeery many lines long.
OUTPUT;

This means "Print the following text until you encouter the LABEL (OUTPUT in our example)"


IMPORTANT:
The terminating label (OUTPUT in this case) MUST start at the beginning of the line. It cannot be indented, not even by a single space. Sorry if you like indenting code but this has got to be the one and only one in the line. Come on I did not write PHP. I just teach it. (Ever heard of the self-proclaimed teacher).

Phew! This is a life saver. You don't have to struggle with escaping all those nerdy HTML tag attributes. Are we together pal? Let's sum our PHP knowledge so far...

Pages: firstback1 2 3 4 5 6 7 8 forwardlast

Similar/related articles:


 
  Sponsors