PHP4 Class – differences from PHP5

Creating a rather simple custom CMS on my client’s server, everything seems ok until I start testing out some of my ready made proprietary PHP classes. The problem is that I make things in PHP5 and all the classes are in PHP5 format.

Quickly searched and scanned through some old tutorials for PHP4 about creating classes. It’s some radical changes indeed. Just to soothe your possible frustrations when migrating PHP5 classes into a PHP4 platform:

  1. PHP4 classes don’t have scope operators such as private, public or protected.
  2. PHP4 constructional function should be the same name with that of the class. __construction won’t work.
  3. Class variables in PHP4 classes are declared with the keyword ‘var‘ rather than private or public.

I thought I might write this down for those who are rewriting PHP5 classes for obsolete implementations of PHP such as PHP4.

4 thoughts on “PHP4 Class – differences from PHP5”

  1. Pingback: PHP: File Upload Script (HTML Form + PHP Handler Class)

  2. Pingback: PHP Resources |

Comments are closed.

Scroll to Top