Categories
PHP Tips & Tutorials

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.

By Yang Yang

Hello, I'm Yang. I build online businesses that please people. Want to join in and post some useful articles on Kavoir.com? Shoot me a message.

4 replies on “PHP4 Class – differences from PHP5”

Comments are closed.