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:
- PHP4 classes don’t have scope operators such as private, public or protected.
- PHP4 constructional function should be the same name with that of the class. __construction won’t work.
- 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”
Pingback: PHP: File Upload Script (HTML Form + PHP Handler Class)
Thanks! Just what I needed.
Pingback: PHP Resources | devdevote.com
Yeah thanks, the __construct() function not working was getting the better of me!
Comments are closed.