Welcome to WebmasterWorld Guest from 34.229.126.29

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

php 4 vs php 5

the difference

     
2:34 am on Aug 29, 2008 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:June 2, 2006
posts:2240
votes: 8


This may sound as a stereotype but itís a real life question for me.

I have a hosting plan where I control what to have installed. Among all, there are PHP 4.4.8 and PHP 5.2.6.

I personally donít know anything about the difference between the two, but I do use PHP for some basic stuff (other people make it for me).
All what I have works fine under both 4 or 5, so far.

As a someone who knows PHP very well, how would you explain the difference (in short), and why would you use one over another?

If you really donít care, please reply as that is also an answer.

Thanks

4:20 am on Aug 29, 2008 (gmt 0)

Junior Member

10+ Year Member

joined:June 6, 2005
posts:109
votes: 0


Functionally, they're pretty similar. There are a few new features in 5 that IMHO make it better. Once you've used them (as a developer) for a while going back to 4 would be less than ideal.

The big thing is that support for PHP4 has ended completely. No more updates, no more security fixes, nothing. It's dead and buried. If there's problems with the last release (4.4.9) those problems are staying for good.

Given this, PHP5 is the only good option for any development and deployment at this stage. Until they release PHP6 :)

8:30 am on Aug 29, 2008 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:July 12, 2007
posts:766
votes: 0


The oop part of php 5 is better than 4.

The largest reason for upgrading is the one that has already been made. PHP4 is no longer supported. So if you can choose then get everything upgraded. PHP4 code should work on php5, so the transition should be easy...having said that check it all first, just in case ;)

10:06 pm on Aug 29, 2008 (gmt 0)

Junior Member

10+ Year Member

joined:Sept 17, 2002
posts:121
votes: 0


The performance of PHP 5 is better than PHP 4.

NN

3:19 pm on Aug 30, 2008 (gmt 0)

Administrator

WebmasterWorld Administrator coopster is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:July 31, 2003
posts:12548
votes: 2


Besides the others mentioned so far I would also add ...

New functions that make programming easier
XML support is better
DOM support is better
Date/time handling is better

I've also found bugs in some areas where the 4.x version was not addressed but PHP5 handles itself as I expect. I do development on a PHP5 platform and sometimes have to port the code to a PHP4 installation and I've run into issues. I'm trying to recall some of those areas and I believe FTP was one. However, I'm certain there were others, just cannot recall right now. I can go through comments in all the code I have and find my PHP4 workarounds but that would take me awhile.

Do yourself a favor, go with 5 :)

6:00 pm on Aug 31, 2008 (gmt 0)

Junior Member

10+ Year Member

joined:Nov 15, 2006
posts: 140
votes: 0


I have hit problems when developing in 5 and then using a production server running 4, some functions in 5 aren't available in 4, functions that for me make scripting in php mushc nicer, if someone else writes the scripts for you i would ask what platform their development machine is running and go for the same version, just to avoid any issues you may have in the future.

Thanks
Chris

10:16 pm on Aug 31, 2008 (gmt 0)

Junior Member

10+ Year Member

joined:June 6, 2005
posts:109
votes: 0


if someone else writes the scripts for you i would ask what platform their development machine is running and go for the same version, just to avoid any issues you may have in the future.

I would do the exact opposite and tell the developer to make them work on my server - using PHP 5.

12:03 pm on Sept 2, 2008 (gmt 0)

New User

joined:Sept 2, 2008
posts:1
votes: 0


as already stated, the OO (object oriented) part was like totally rewritten in php5. huge advance.
3:57 pm on Sept 2, 2008 (gmt 0)

Senior Member

WebmasterWorld Senior Member penders is a WebmasterWorld Top Contributor of All Time 10+ Year Member Top Contributors Of The Month

joined:July 3, 2006
posts: 3127
votes: 1


I do development on a PHP5 platform and sometimes have to port the code to a PHP4 installation and I've run into issues. I'm trying to recall some of those areas and I believe FTP was one.

If you have PHP5 code that takes advantage of the new Object/class model then it could be very difficult to go back to PHP4. However, relatively easy to modify PHP4 code to work on a PHP5 platform (and most of the time you won't have to change a thing).

PHP5.0.0 to PHP5.3.0 offers zend.ze1_compatibility_mode to enable compatibility with PHP4 in some areas - if you should need it.

Also new for developers...
- Exception handling (Although not as useful as in other languages IMHO) [webmasterworld.com]

The OOP and XML handling is enough for me to not want to go back to PHP4. Only if you had a big app that you had to support and was stubborn enough to only work under PHP4 would you run PHP4, IMHO.

Migrating from PHP 4 to PHP 5.0.x [uk2.php.net]

 

Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members