Introduction to PHP

In this tutorial we go over PHP as a programming language, what it's used for and why you should learn this powerful programming language to develop your dynamic website.

We also cover the learning level of difficulty and any prerequisites needed.

Here's a table of contents of what you'll learn in this lesson:
(click on a link to skip to its section)

Let's jump right in.

What is PHP?

PHP is a scripting language used to develop static and dynamic web pages and web applications. PHP stands for Hypertext Pre-Processor.

PHP was created in 1994 by Rasmus Lerdorf. The first incarnation of PHP was a set of CGI (Common Gateway Interface) binaries written in the C language.

What is PHP used for?

PHP dominates the web space in terms of a server-side application language. PHP can be found in most of the web.

Websites like:

  • Facebook
  • Wikipedia
  • Yahoo
  • Tumblr
  • Sourceforge
  • etc.

Content Management Systems:

  • WordPress
  • Joomla
  • Drupal
  • ModX
  • Concrete5
  • etc.

eCommerce Systems:

  • WooCommerce
  • OpenCart
  • Magento
  • ZenCart
  • OsCommerce
  • etc.

Why PHP?

PHP is widely used in web development. About 78% of developers on the web use PHP as their server-side language of choice.

Advantages:

  • PHP is cross platform.
  • PHP can easily interface with Apache, MySQL, Java and various other technologies.
  • PHP allows easy database connection through built-in modules and significantly reduces time needed in developing data-driven web applications.
  • PHP is interpreted, there is no need for a compiler.
  • PHP is Open Source. It's readily available and entirely free.
  • PHP is easy to use. It has a well-organized syntax which is simple, fluent, clean and logical.
  • PHP is widely used and as such, have a well established internet community that can answer almost any question.
  • PHP is faster than other scripting languages like ASP and JSP.
  • PHP files may contain HTML, CSS, Javascript, Ajax, XML, JSON and jQuery. There is no need to write separate pages for these other technologies.
  • Create Facebook applications, and easily integrate Facebook plugins in your website with Facebook's PHP SDK.

Disadvantages:

  • PHP has poor error handling. PHP lacks the debugging tools available in other languages which are often needed to search for errors and warnings.

    However, as mentioned above, one of its advantages is that the PHP community is so big that help can easily be found on the internet. If a problem exists, it has probably already been asked and answered somewhere.

Is PHP hard to learn?

Even though PHP has become more complex in recent versions, it remains one of the easiest languages to learn. It doesn’t require intensive studying and is easily understood, which makes it perfect for beginners.

Prerequisites

Before we proceed, please note that we make the following assumptions:

  • You know how to install software on whichever operating system you use.
  • You can create and navigate directories and files on your computer.

It is beneficial to know other web technologies such as HTML and CSS but not strictly necessary as we will cover some small amounts of it, when needed, in this tutorial series.

While this tutorial series is for beginners with no knowledge of PHP or programming in general, programmers coming from other languages that want to learn PHP will also find it very helpful.

This tutorial series covers many topics of programming in PHP, ranging from beginner concepts to advanced.

PHP Development Environment Setup

A development environment is all the tools and procedures that is necessary to develop, test and debug an application.

In the following tutorials we will learn how to set up a PHP environment with a free IDE, PHP Parser, server, database, control panel, and more.

What is needed to develop in PHP

To develop a PHP application we require the following:

  1. PHP Parser. The parser will process all PHP scripts and generate the HTML output.
  2. Web Server. A web server is that serves files to users in the form of web pages. PHP can be installed on virtually any web server such as Apache or Nginx.
  3. Database (optional). A database is used for long term storage on a server. PHP can be used with many database systems such as Oracle, MySQL, MariaDB, or PostgreSQL.
  4. Text editor or IDE. We need, at least, a simple text editor application to type out our PHP scripts. Most commonly, an IDE (integrated development environment) is used which provides us with more ease-of-use functionality than a simple text editor can.

In this PHP tutorial series we will use the following:

  1. Atom free IDE
  2. XAMPP free PHP development environment. Includes the Apache web server, PHP parser and MariaDB database, among others.

List of Tutorials