What is the difference between PHP-4 and PHP-5?

PHP4

  1. Passed by value only
  2. Duplicate an object by assigning it to another variable
  3. A constructor was simply a method that had the same name as the class itself
  4. Not support abstract class
  5. Not support interface
  6. Not support magic methods
  7. Not support final

PHP5

  1. Passed by value and passed by reference
  2. Duplicate an object by clone keyword
    Function __clone(){
    $this->obj = clone $this->obj;
    }
  3. It introduces a new unified constructor/destructor
    __constructor
    __destructor
  4. It allows to declare a class as abstract
  5. Supports interfaces
  6. Supports Maic methods
    __call, __get, __set and __toString
  7. Use final keyword
  8. Supports exceptions
  9. Inclusions of visibility

About pj

I am an expertise web programmer in PHP.
This entry was posted in Interview Questions, PHP. Bookmark the permalink.

Leave a comment