PHP Script Source Code File Format

This section describes the PHP script source code file format - A text file with PHP code segments mixed into non-PHP text. The most common way to mix PHP codes is to use the PHP processing tag '?php'.

Like any other scripting language, PHP is used to transform text information from an input to an output by mixing PHP code segments in the input text. This input of mixed PHP code and non-PHP text is called PHP script source code, which is usually stored as a text file.

Since multiple PHP code segments can be mixed with non-PHP text, a PHP script source code will look like this:

text PHP_code text PHP_code text PHP_code ...

When you ask the PHP to process a PHP script source code, it will separate PHP code segments from the non-PHP text using following 3 default rules:

1. PHP processing tag: <?php PHP_code ?> - Everything included in the "php" tag will be processed as PHP code. For example:

Hello <?php
   $name = "Herong";
   echo $name;
?>
, Nice to meet you!

2. PHP processing tag shorthand: <? PHP_code ?> - Everything included in the "php" tag will be processed as PHP code. For example:

Hello <?
   $name = "Herong";
   echo $name;
?>
, Nice to meet you!

3. HTML "script" tag: <script language="php">PHP_code</script> - Everything between the "script" starting tag and the "script" ending tag will be processed as PHP code. For example:

Hello <script language="php">
   $name = "Herong";
   echo $name;
</script>

, Nice to meet you!

The PHP processing tag is the most commonly used way to mixed PHP codes into non-PHP text to create a PHP script source code file. Since most PHP scripts are designed to generate Web pages, non-PHP text in a PHP script source code is made of mostly HTML tags. Here is an example of a PHP script source code that generates a simple Web page:

<html>
<head>
<title>Welcome Page</title>
</head>
<body>

<p>
Hello <?php
   $name = "Herong";
   echo $name;
?>
, Nice to meet you!
</p>
</body>
</html>

Table of Contents

 About This Book

 2002 - .NET Framework Developed by Microsoft

1995 - PHP: Hypertext Preprocessor Created by Rasmus Lerdorf

 Introduction of PHP: Hypertext Preprocessor

PHP Script Source Code File Format

 1995 - Java Language Developed by Sun Microsystems

 1991 - WWW (World Wide Web) Developed by Tim Berners-Lee

 1991 - Gopher Protocol Created by a University of Minnesota Team

 1984 - X Window System Developed a MIT Team

 1984 - Macintosh Developed by Apple Inc.

 1983 - "Sendmail" Mail Transfer Agent Developed by Eric Allman

 1979 - The Tcsh (TENEX C Shell) Developed by Ken Greer

 1978 - Bash (Bourne-Again Shell) Developed by Brian Fox

 1978 - The C Shell Developed by Bill Joy

 1977 - The Bourne Shell Developed by Stephen Bourne

 1977 - Apple II Designed by Steve Jobs and Steve Wozniak

 1976 - vi Text Editor Developed by Bill Joy

 1974 - Internet by Vinton Cerf

 1972 - C Language Developed by Dennis Ritchie

 1971 - FTP Protocol Created by Abhay Bhushan

 1970 - UNIX Operating System Developed by AT&T Bell Labs

 1957 - FORTRAN Language Developed by IBM

 References

 Full Version in PDF/EPUB