01 - Introduction to PHP5

PHP is an Open source scripting language that is widely used to create Dynamic websites having database connectivity. The name PHP is short form of “Hypertext Preprocessor”. The PHP was initially created by Rasmus Lerdorf in 1994. He authored the first two versions of PHP. He collaborated with the PHP community that was led by Andi Gutmans and Zeev Surakski (both are founders of Zend technologies to produce later versions). The latest version of PHP is version 5.5.15 launched on 24 July 2014.

The Beta version of PHP 5.6.0RC3 will be released on 31 july 2014.

PHP is now become the most widely used scripting language for web, internet, e-commerce and B2B projects It is cross-platform language and can be used everywhere. It can run on all most all Operating systems (Linux, windows, Solaris, HPUX and UNIX). PHP is write once and deploy anywhere and everywhere type of language, and it supports almost all web servers like Apache, Microsoft IIS etc.

PHP is 5 to 20 times faster than Java and it is blended with Java, C++, PERL and C language best features. PHP can be compiled and optimized to make it run faster by using Zend Optimizer that is integrated with PHP. It can be used with the combination of HTML, DHTML/ XML and Javascript.

PHP scripts can be executed from command line and develops client side GUI applications that can operate on any platform.

What is scripting language?

Scripting means a series of commands that are interpreted and executed sequentially and immediately when any event occurs. Event is basically an action generated by user while interacting with a web page.

There are two types of scripting languages:

  1. Client side scripting

       This type of script is executed on client side by browser.

  1. Server side scripting

This type of script is executed on server side. PHP comes under this category. Server side script interacts with database, fetch the required information specific to the user and display it to the user.

Server side scripting is invisible to the user. In server side scripting, the following two types of two way communication is done:        

  1. Server to client

          Web pages can be assembled from back end server output.

  1. Client to server

          Customer entered information can be acted upon. In this type of scripting two main parts are used:

The scripting language

The scripting engine

The following are some of the tasks that can be implemented using server side scripting language. 

  1. Content sites
  2. Forums, bulletin boards
  3. E-mail
  4. Customer support and technical support systems
  5. Advertising
  6. Business applications
  7. Surveys and polls
  8. Submission of forms online
  9. Catalog, brochure and informational sites
  10. Games















Features of PHP5:

  1. Improved object oriented capabilities

       In PHP 5 explicit constructors and destructors are available. Object cloning, class abstraction, variable scoping, interfaces and improvement in object management.

  1. PHP strict standard
  2. We can declare FINAL classes and methods in PHP5

      FINAL method means that they cannot be overridden by a derived class.

      FINAL class cannot be extended.

  1. Objects in PHP5 can have 3 magic methods

      _ sleep()

      _ wakeup()

      _ toString()

  1. Try/Catch Exception handling

      In try catch exception handling finally keyword is added. It allows developers to specify code to be run at the end of try and catch blocks, whether the exception was thrown or not.

  1. Improved XML and web services support
  2. SOAP extension available

      SOAP stands for Simple Object Access Protocol. This is light weight XML based protocol for exchanging structure information between distributed applications over native web protocols such as HTTP, SOAP specifies the formats        that XML messages use.

  1. Native support for SQLite

       PHP 5 supports SQLite database server, which offers an easy solution for developers in case there is need to access heavy database products, without administrative privileges overhead.

  1. Generators

       Generators provide a way to handle iteration without having to write a class that implements the Iterator interface.

  1. Password Hashing

       Password hashing API is the most important feature of PHP5. By using password_hash() and password_verify() functions, developers can easily handle password hashing in their sites.

  1. Array and String Literal Dereferencing

       Array and string literals can now be de-referenced using array access syntax.

  1. Use of empty() with function ca.lls and expressions

      The empty() construct can now be used with function calls and other expressions. That makes possible to use empty() on the return value of functions without capturing the value in a variable first.

  1. Class name resolution

      Concept of namespaces in PHP is introduced. Now classes can be organized easily without any naming conflictions

  1. Changes in foreach loop

       The list() construct in PHP allows the values of an array to be easily assigned to variables.

Like us on Facebook