PHP: Hypertext Preprocessor .edu



PHP: Hypertext Preprocessor

Brian Wright

October 18, 2004

Introduction:

The acronym PHP stands for PHP: Hypertext Preprocessor, and is a web development language that is syntactically similar to C. Not only is the language syntactically similar to C but the underling development of PHP was performed using the C language. The main objective of the language is to allow for the easy creation of dynamic web pages. PHP has evolved to become a technology that is utilized by approximately thirty-three percent of the web domains on the Internet (Lerdorf). Since the prominence of PHP is so great, the goal of this paper is to provide the historical and technical background on it as well as the advantages and disadvantages to using this technology.

Historical Background – Prior PHP:

HTTP is a stateless system. This means that it does not save any data across pages. Web pages that include forms need, most often, to save data. The way web page forms were interpreted during the early to mid 90’s was through parsing the URLs for the data. The mainly used technology to parse this information was C (Hudson).

For instance, take a hypothetical web page that includes two text-input boxes: firstName, and lastName. Suppose that a user inputs “John” and “Smith” into the input boxes on this web page and then clicks submit. By default, the URL generated would be concluded with: firstName=John&lastName=Smith. Programmers would use the C programming language to decipher this information into however necessary variables and values. This process is known as parsing. Utilizing C to parse this information was, according to Paul Hudson, the author of Practical PHP Programming, “very clunky to program – a simple parsing program could easily take up fifty lines or more [of code].”

With the problems involved in parsing data in C came the creation of PERL—Practical Extraction and Report Language. PERL allowed even novice programmers to successfully parse HTML form data. One of the largest drawbacks to using PERL was that it was written so that in order to output HTML, HTML must be embedded into the PERL program. Another way to phrase this is that PERL is PERL-centric.

Historical Background – PHP:

The first version of PHP was created by Rasmus Lerdorf in 1995 and was called: Personal Home Page/Form Interpreter: PHP/FI. According to Lerdorf’s article—entitled: Do You PHP?—the reason he created PHP/FI was “purely a case of needing a tool to solve real-world Web-related problems.” PHP is a HTML-centric language. This means that PHP code is actually embedded inside the HTML (Hudson). PHP/FI was “mostly a C library of common C functions that [Lerdorf] had written” (Lerdorf, Do You PHP?). An early example of PHP/FI code is this:

Hey, you are using Netscape!

This code would check for the web browser agent and print a string if it the agent was Mozilla.

Lerdorf was not satisfied with the original parser he wrote and decided to write a new one. Instead of encompassing the commands with , he chose to change it to ................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download