Whats new in PHP 5.5 / 5.4 / 5.3?

Whats new in PHP?

This is a quick reference on whats been added / removed or upgraded on new versions of php.

PHP 5.5

Release date: 2013-06-20

Features and Updates

  1. Generators and coroutines
  2. “finally” keyword
  3. New password hashing API
  4. “foreach” now supports list()
  5. “empty()” supports arbitrary expressions
  6. Array and string literal dereferencing
  7. Zend OPcache extension for opcode caching.
  8. Array_column
  9. Improvements to GD
  10. Class name resolution via::class
  11. Datetime impromvents
  12. A lot more improvements and fixes.

PHP 5.4

Release date: 2012-03-01

Features and Updates

  1. Trait support
  2. Short array syntax support
  3. Built-in web server (CLI).
  4. Performance and reduced memory requirements
  5. Instance Method Call
  6. Closure Binding
  7. Objects as Functions ( Function de-refernecing)
  8. JsonSerializable Interface
  9. Binary Notation
  10. Short open tag
  11. Session Upload progress
  12. Default charset is now UTF-8

Many more improvement and fixes

Removed items:

  • register_globals,
  • safe_mode,
  • allow_call_time_pass_reference,
  • session_register(),
  • session_unregister()
  • and session_is_registered().
  • break / continue $var syntax removed
  • ext/sqlite moved to pecl

PHP 5.3

release date: 2009-06-30

Features and Updates

  1. Namespaces concept is added in Php 5.3
  2. Support for Late Static Bindings has been added.
  3. Support for jump labels (limited goto) has been added.
  4. There are two new magic methods, __callStatic() and __invoke().
  5. Nowdoc syntax is now supported, similar to Heredoc syntax, but with single quotes.
  6. Constants can now be declared outside a class using the const keyword.
  7. Ternary short cut “?:”
  8. Optional garbage collection for cyclic references
  9. Optional mysqlnd PHP native replacement for libmysql
  10. 140+ bug fixes.

Removed items:

Removed the following extensions: ext/mhash (see ext/hash), ext/msql, ext/pspell (see ext/enchant), ext/sybase (see ext/sybase_ct)

Moved the following extensions to PECL: ext/ming, ext/fbsql, ext/ncurses, ext/fdf
Removed zend.ze1_compatibility_mode

Difference between Interface and abstract class – PHP Tutorials

Many of us normally end up with confusion about interface and abstract class, so in this post i am trying to clear it out, and highlighting the usuages.

What is Interface?

Interface is just a interface as the name implies, it just a definition of objects and methods with no body  on it. So its a collection of objects and methods that can be used by other class to perform common function. So its a just a place to specify objects and methods but does not explain you, how it is used or defined.
Its a practice to make clear rules on class.

So in summary, interface doesn’t do any thing, its just a pattern to be follow.

Class can inherit more than one interface.

What is Abstract class?

Abstract class is little more than interface classes, it not only defines the objects / methods  but also explain, what it suppose to do as default.  It may / may not define all the methods so it can leave some of the method to be implement by those who inherits it. Class who inherits it can add more methods / objects, those are not provided by the abstract class unlikly to interface.

Objects of an abstract and interface class cannot be created.

Private methods cannot be define in Abstract class as its cant be used by classes using abstract.

What is the Difference between Abstract Class and Interface

  1. Can inherit only one abstract class but can inherit more than on interface.
  2. Abstract provides complete code but interface is just a pattern to be follow.
  3. Abstract class is faster as it has complete code while interface is just a pattern so more classes are loaded.
  4. If new method is added to abstract class, all class that inheriting might work but if we add method in interface we have to define method in all inherited classes.
  5. Class using abstract classes may / may not follow everything from abstract class and call add more  but interface must be followed.
  6. Class can overwrite the method of abstract class but interface we just follow the same.
  7. Completely non related classes can follow same interface but in abstract this may not be possible.

Example of Abstract Class:

abstract class Member {
    public $fname;
    public $lname;
    public $address;
    public $phone;

    public function addData($fname,$lname,$address,$phone) {

    protected function getName() {
    return $this->fname.' '.$this->lname;

Class using Abstract class:

class Employee extends Member {

    public $emp_name;
    public $emp_address;
    public $emp_phone;

    public funtion getFullName() {
        $this->name = $this->$emp_fname;
        $this->lname = $this->$mp_lname;
        echo $this->getName();
          public function someFunction() {        };

In above example, class inheritting abstract class Member 
is only using one method of the class. And also has some extra class on it. 

Example if Interface:

Interface  Member {

    public function addData($fname,$lname,$address,$phone);

class Employee implements Member {

    public $emp_name;
    public $emp_address;
    public $emp_phone;

    public funtion addData($fname,$lname,$address,$phone) {
        // code

        }                 }