left-icon

PHP Succinctly®
by José Roberto Olivas Mendoza

Previous
Chapter

of
A
A
A

CHAPTER 1

An Introduction to PHP

An Introduction to PHP


What is PHP?

PHP is an open source, general-purpose scripting language oriented for web development. This language was originally created by Ramsus Lerdorf in 1994, and it was known as Personal Home Page / Forms Interpreter. The first version of PHP/FI was released in 1995. PHP/FI 2.0 appeared later, in 1997. PHP is now supported by The PHP Group, and the PHP acronym stands for PHP: Hypertext Preprocessor. The current stable release of PHP at the time of writing is 7.0.13.

PHP is normally processed by an interpreter, which is implemented as a web server module, so the web server combines the results of the PHP code and returns a webpage to the client (usually a web browser). The standard PHP interpreter is powered by the Zend Engine, a free software released under the GNU/GPL license that allows the use of the software for any purpose, including commercial projects. The interpreter can be obtained from the PHP Group website under the same license terms.

One of the best features of PHP is its simplicity for newcomers, which allows you to write simple scripts in a matter of hours. The language also offers a series of advanced features for professional programmers. The following table summarizes PHP’s main features.

Table 1: PHP Main Features Summary

Feature

Description

Open source and free to use

Perhaps the most important feature for many developers. This feature has made the PHP developers community grow increasingly because there’s no need to acquire any license to start with any kind of project.

Multi-platform

PHP can be used in many operating systems, such as Windows, Mac OS X, or Linux. PHP is supported by the most of the web servers today, including Apache and IIS.

Interpreted language

Unlike the C or C++ languages, in which code needs to be compiled to run on computers, PHP code is interpreted at the time it is used. This task is performed by the PHP interpreter implemented in the web server.

Procedural programming support

PHP allows to you employ procedure and function call programming paradigms.

Object-oriented programming support

PHP allows the use of object-oriented programming concepts like inheritance, polymorphism, and abstraction.

C-like syntax

PHP programming syntax is C language-oriented.

Non-strongly typed

There’s no need to specify the data type for variable declaration. The type is determined at run time.

Predefined super-global variables

A set of variables whose names start with a _ that can be accessed along the entire script execution, no matter where they are invoked. Some examples are $_GET, $_SESSION, and $_SERVER.

Database support extensions

PHP supports a wide range of databases, such as MySQL and PostgreSQL. ODBC databases are also supported.

Text processing

PHP has a set of useful text-processing features such as regular expressions, or XML documents accessing and parsing.

Non-HTML output capabilities

PHP can generate images, PDF files, or XHTML text on the fly, and save them in the file system. This can be useful to form a server-side cache in order to manage dynamic content.

Error Handling (PHP 7)

PHP 7 throws an exception when an error occurs during script execution. This exception can be caught to avoid script-crashing.

Besides the features detailed in the previous table, we can also say that PHP can be embedded into HTML, or HTML can be called from PHP. In this way, all HTML code for an entire website can be processed by PHP, so the webpages for this site can be created dynamically.

PHP also allows you to create variables dynamically. This is accomplished by using the value of a declared variable as the name for another variable (which will be explained in Chapter 3).

Chapter summary

This chapter gave a brief introduction to the PHP programming language. The most important aspects of PHP are summarized in the following list.

  • PHP is an acronym for PHP: Hypertext Preprocessor
  • PHP is an open source language, free to download and use
  • PHP is executed on the server
  • PHP can generate dynamic page content
  • PHP can connect to a wide range of databases
  • PHP can run on various platforms (Windows, Linux, UNIX, Mac OS X, etc.)
  • PHP is compatible with almost all web servers used today (IIS, Apache, etc.)
  • PHP is easy to learn for newcomers
Scroll To Top
Disclaimer
DISCLAIMER: Web reader is currently in beta. Please report any issues through our support system. PDF and Kindle format files are also available for download.

Previous

Next



You are one step away from downloading ebooks from the Succinctly® series premier collection!
A confirmation has been sent to your email address. Please check and confirm your email subscription to complete the download.