What is PHP Programming and What Can PHP Do For My Website?

I’ve been ask numerous times as a web developer what PHP programming is.  Generally speaking, PHP is used to add functionality to a website that HTML alone cannot achieve.  However, PHP is much more than that! 

What does PHP stand for?

PHP was created in 1994 by Rasmus Lerdorf to track the visitors to his online résumé.  It originally stood for “Personal Home Page.” As its capabilities grew it came to stand for “Hypertext Preprocessor,” which basically means that PHP handles data before it becomes HTML (HyperText Markup Language).

What is PHP?

According to the official PHP website, PHP is “a server-side, HTML embedded scripting language.” This may sound like confusing, but it’s fairly straightforward and meaningful when broken down into its parts.

What is a server side scripting language?

Server-side refers to the fact that everything PHP does occurs on the server (as opposed to on the client, which is the Web site viewer’s computer).  As an example, when a web browser accesses a URL, it is making a request to a Web server.  If you are requesting a PHP page, something like http://www.mycompany.com/about.php, the Web server starts up the PHP parsing engine and processes any PHP instructions found on the page before it returns the resulting output.  The most common output is HTML which is passed back to the Web server code in the document, which in turn is passed on to your browser, which displays on your screen.

What is HTML embedded code?

HTML embedded means you can put PHP code into your HTML code (HTML being the code with which all Web pages are built). Because PHP is embedded within tags, the author can jump between HTML and PHP instead of having to rely on heavy amounts of code to output HTML. And, because PHP is executed on the server, the client cannot view the PHP code.

What is the different between a scripting language and a programming language?

PHP is a scripting language, as opposed to a programming language. This means that PHP is designed to do something only after an event occurs; for example, when a user submits a form or goes to a URL. Programming languages such as Java, C, C++,  and Perl can write standalone applications, while PHP cannot.

What can PHP do?

PHP does anything a PHP programmer wants it to, except stand on its head!  Actually, with some on-the-fly image manipulation and Dynamic HTML, it can do that too!  However, PHP’s main goal is to allow web developers to write dynamically generated pages quickly. 

Some basic examples of common uses of PHP include:

  • Perform calculations and mathematical equations
  • Access a wide range of databases
  • Create a web interface for adding, deleting, and modifying elements within your database
  • Generate HTML content on-the-fly
  • Set and access cookie and session variables
  • Authenticate a user to restrict access to sections of your Web site
  • Encrypt data
  • Create images on the fly such as CAPCHA verifications
  • Generate PDF or Excel documents on the fly
  • Auto-generate files, and save them in the file system

There are many other advanced features and benefits PHP can offer.  Such powerful features are used everyday in popular web applications such as WordPress and Facebook.  So, if you’re new to web development, hopefully this helps you understand what PHP is and the type of things this dynamic language can bring to your website.