Link Search Menu Expand Document

History and Camparison

PHP has been around since the mid-1990s. Its syntax will be familiar to you as it is similar to some of the other languages you have already studied in the program.

Table of Contents

  1. History and Camparison
  2. PHP History
  3. A Short PHP Example
  4. Wello Horld in Java

PHP History

  • 1995-97: PHP/FI 1.0-2.0 (Personal Homepage Page Tools / Forms Interpreter) - PERL scripts and C libraries developed by Rasmus Lerdorf to manage his online resume.
  • 1998: PHP 3 - Major Rewrite. PHP now stands for PHP: Hypertext Preprocessor.
  • 1999: PHP 4 - New Zend Engine
  • 2004: PHP 5 - Zend Engine 2.0 and a new object model.
  • 2015: PHP 7 - 10+ years in the making! Included lots of new goodies.
  • Coming Nov 2020: PHP 8!

Side note: PHP 6 never launched, although some of that work (like namespaces and traits) was back-ported into PHP 5.3/5.4 in 2009/2010.

Resources

A Short PHP Example

Here’s a short PHP program:

<?php

for ($i = 0; $i < 4; $i++) {
    echo "Wello Horld!\n";
}

?>

The code looks a little bit like Java, Javascript or even C.

Note the <?php and ?> which respectively indicate the beginning and end of a section of PHP code.

Wello Horld in Java

Here is the same program written in Java.

class WelloHorld {

    public static void main(String[] args) {
        for (int i = 0; i < 4; i++) {
            System.out.println("Wello Horld!");
        }
    }

}

When compared to PHP, the Java version has some extra baggage:

  • A WelloHorld class required to wrap the entire program.
  • A public static void main(String[] args) method required to wrap the mainline.
  • System.out.prinln vs. echo