Results 1 to 6 of 6

Thread: Difference between PHP4 and PHP5

  1. #1
    Join Date
    May 2009
    Posts
    837

    Difference between PHP4 and PHP5

    I have worked with PHP4 for quite a time and I have a good knowledge about the language. Now, I want to use PHP5. But, I want to know that if there is a great difference between PHP4 and PHP5. Will it be simple or confusing for the programmers who have already used PHP4? What are the additional features of PHP5 as compared to PHP4? People with knowledge about PHP are requested to reply with suitable solutions.

  2. #2
    Join Date
    May 2008
    Posts
    2,012

    Re: Difference between PHP4 and PHP5

    Taking about the difference between PHP4 and PHP5, it is the OOP feature that has a significant change. In, PHP4 everything including the objects were passed by value. In PHP5, this has been changed and everything including the objects are passed by reference. So, this has greatly helped the programmers using PHP4. If you have a good knowledge of PHP4, you will not find any great difference among the the two languages.

  3. #3
    Join Date
    Oct 2005
    Posts
    2,393

    Re: Difference between PHP4 and PHP5

    The problem that the programmers had in PHP4 was that inorder to create a duplicate of an object, it was simply copied and assigned to another variable. This has completely changed in PHP5. Here, you will get the "clone" keyword, that is a new addition to this version. This is a major difference between PHP4 and PHP5, that is worth mentioning, otherwise most of the things are same.

  4. #4
    Join Date
    Jan 2008
    Posts
    1,521

    Re: Difference between PHP4 and PHP5

    The major difference between PHP4 and PHP5 is that PHP5 allows to create class constants that act in the same way we do for the defined constants. The only thing to be kept in mind is that it must be contained inside a class definition. The :: operator can be used to access it. With this feature coming into PHP5, you will no longer be required to use the & operator, that is also called as the reference operator.

  5. #5
    Join Date
    Feb 2008
    Posts
    1,852

    Re: Difference between PHP4 and PHP5

    You will be able to use the static methods and properties in PHP5. This is the major difference between PHP4 and PHP5. Whenever a class is defined as static, it is able to access the members with the help of the :: operator without having to use an instance. This has greatly helped the programmers to reduce the time that they used for creating the instance of the classes, that is the objects.

  6. #6
    Join Date
    May 2008
    Posts
    2,389

    Re: Difference between PHP4 and PHP5

    According to me the greatest difference between PHP4 and PHP5 is that there is visibility for the class methods and the properties. The 3 visibilities available are:
    1. PUBLIC
    2. PROTECTED
    3. PRIVATE

    It has also introduced an entirely new names for the constructors and destructors that are unified. It also allows you to define an abstract class. The best feature is that I liked is the introduction of interfaces and also the magic methods that makes it totally different from the previous version.
    Last edited by opaper; 30-12-2009 at 05:08 AM.

Similar Threads

  1. PHP5 - PHP login registration help
    By Orlando in forum Software Development
    Replies: 5
    Last Post: 01-05-2011, 03:24 AM
  2. How to Install Nginx with PHP5 on Fedora 12
    By OSzilla in forum Operating Systems
    Replies: 5
    Last Post: 09-02-2010, 03:36 AM
  3. Does PHP5 Inheritance has different features that PHP4
    By Zombi in forum Software Development
    Replies: 3
    Last Post: 15-09-2009, 04:54 PM
  4. Abstract Classes in PHP5
    By nonose in forum Software Development
    Replies: 2
    Last Post: 16-06-2009, 02:33 PM
  5. Destructor in PHP5
    By Duck in forum Software Development
    Replies: 3
    Last Post: 18-03-2009, 12:01 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,715,572,523.84968 seconds with 17 queries