What Is a PHP File

From LoveToKnow Web-Design

Anyone beginning to delve under the hood of web design will have to find the answers to questions like "What is a PHP File?" PHP is only one of many acronyms and jargon that help designers and coders alike make sense of the vast forest that is information technology.

What is a PHP File

So What IS a PHP File?

The easy answer to that question is that PHP stands for "PHP Hypertext PreProcessor." However, even those not familiar with programming will note that this answer is a recursive acronym, and there's simply a loop of question and answer that is never-ending – an example of programmer's humor.

The more informed answer lies in the history of PHP, which originally stood for "Personal Home Page" and was a series of scripts and related tools created by Danish programmer Rasmus Lerdorf. He initially made these just for his own use, but they were released to the open-source community in 1995. Not long after, two Israeli programmers, Zeev Suraski and Andi Gutmans, took up the project and turned it into a much more robust programming platform. Since then, the language has gone through 5 revisions and features many flexible tools and capabilities:

  • Interaction with databases such as MySQL
  • Object-oriented capabilities familiar to programmers of C++, Perl, etc.
  • Ability to be used as web input on a server to generate HTML
  • Ability to be embedded in HTML
  • Compatibility with multiple operating systems
  • Constant security updates and bug fixes

All of these features have made PHP almost ubiquitous on over 20 million websites and 1 million web servers, according to [1].

Dynamic Filters and Interactive Content

However, knowing the answer to "What is a PHP file" doesn't help you figure out what that little file with the ".php" suffix actually does. Simply put, it is what keeps the web from being nothing more than an efficient newspaper or textbook. Hypertext Markup Language and Cascading Style Sheets are wonderful for making information look pretty, and easy to read and cross-index, but it is PHP which makes it truly interactive.

Server-side Scripting

It's the "preprocessor" part of the name that really makes the magic happen. When a web server is asked to present a straight HTML file, it simply presents the information as programmed by the designer – colors, links, fonts, etc. However, when a file has a ".php" extension, the server knows that before the user is shown the information, there is code to be processed.

This code may gather information and act on it without the user ever having any input. For example, PHP engines (as the processing programs are called) can detect what kind of computer a user has, what time of day it is, or what language they speak. This can then influence what kind of information is presented on the web page. The .php file gathers whatever variables the programmer wants and then generates the HTML code that is actually sent out to the user's computer screen. Instead of:

"Hello, User. Please select your language and operating system."

the user in France might get something like:

"Bonjour, Francois, comment ca va ce matin? Est-ce que vous voulez l'application nouveau pour votre Mac maintenant?" ("Hello, Frank, how are you this morning? Would you like the new software for your Mac now?")

It's fairly clear which version is more welcoming and more apt to attract and keep users on a site. But the flexibility of PHP files goes much further than this, and it is continually being developed, with big news in the works, like registered globals and magic quotes being done away with in the next iteration of the operating system.

PHP Legacy

As flexible and well-loved as PHP files are, they are living on Internet time, which means that as a platform developed in 1995, they are ancient. New programming platforms such as Flash's ActionScript, Ruby on Rails, and AJAX are all becoming successors to the PHP language. However, it has proven so useful for so many years that it is almost a requirement in any programmer's toolkit, and shows no sign of giving up its popularity anytime soon.



 


Comment on What Is a PHP File



(Displayed with your comment)                        (Will not be displayed)
Verification Code:   
    

Web Design Categories
LoveToKnow Tools