Both of them are used. PHP5 catches up pretty slow though. PHP4 is widely used on websites. If you're into learning I would recommend PHP5 which has a better aproach to OOP.
i have a solaris 10 server with tomcat5.5.20, using jsp mostly and now i want deeply in php thank for suggestion
I like 5 much, much more than 4. It has many more features included with it and it supports true OOP. There are some performance issues that I have heard people complaining about, but I haven't seen anything alarming enough to turn me away from it.
PHP object orientated code is way way overrated. It's mostly Asian coders that I've seen that do it, generally north american and eastern european coders do not. PHP5 redid their OOP bits in their code. As far as PHP4 to PHP5, 5 is more becoming the standard, a lot of webhosts are still using 4. They operate almost entirely the same, you don't have to worry about which one to "learn", it's not a Microsoft product PHP5 has a couple of new features that are cool, but it doesn't make a huge difference which one you use unless you're using one of the new functions, which you probably won't.
Currently, most of the hosting company using PHP4, so I prefer you to use PHP4 until PHP5 will hit the spot... I'm not saying that PHP4 is better, the invert is right...
If you're developing an application, it's not usually wise to develop for the old version unless there is a good reason to hold back. Otherwise you'll just end up re-coding to support the newer version in the future. If PHP5 came out last week, I'd say stick with PHP4. Otherwise, go for 5.
"If PHP5 came out last week, I'd say stick with PHP4. Otherwise, go for 5." I'm saying if it was the first week the new revision came out it doesn't make good sense to instantly going with the newer version just because it's new. Look at Windows Server 2003. If you migrated just cuz it was new and out good luck moving your Exchange 2000 domain to it because there were 100s of issues that cropped up when it came out.
Code wise it really doesn't matter. PHP 5 introduces new functions and better OOP techniques but if you got by with in 4 or didn't develop many OOP based scripts, theres really no point. As usual, the industry is slow to adapting the new versions, and PHP 6 is just around the corner, so if you are a developer you would be cutting your clientbase in about half because many hosts do not support 5 yet..
PHP6 is going to be so sexy, I can't wait! But really PHP4 and PHP5 are almost 100% cross-compatible, there are only a few new functions and they really aren't that essential, so for 99.996% of all projects that use PHP, either version would suffice.
Despite the announcement coming out on April 1st it would seem that support for PHP4 really is being dropped at the end of the year. It really is time people moved to PHP5.
I code publicly for PHP4 but my scripts are compatible with PHP5 - I don't see why others don't go that route. By factoring in multiple versions you expand your prospective audience. Of course, private code can be purely PHP5 because I know that I can support it.
I don't think it's really that quickly, a couple years isn't that bad of a turnaround. PHP5 really wasn't anything that great over PHP4 other than a lot of optimizations and such. It may have a little to do with everything being multi-core or multi-processor now so PHP6 will most likely take advantage of multiple cores and operate a bit better, but for the most part there hasn't been any major changes as far as developers are concerned unless you rely heavily on object oriented code