Forum Moderators: coopster
I love php/mysql, and I'm excited to learn about php5 and especially it's object oriented features.
However, 90% of my work is in a shared hosting environment, where I don't have the luxery of installing php5. My question is, why isn't it implemented more widely? I know upgrading is a pain, but php5 has been around for a while now.
Watching php development, I see that php4 and php5 are being developed side by side. Seems a bit odd. Any thoughts on when, if ever, php5 will become the standard?
thanks,
Dave
Also, it's harder to get PHP5 and PHP4 to run next to each other nicely and offer both like most hosts did during the PHP3/PHP4 transition period.
Also, I think it's like the browser upgrade thing. The upgrade from Mosaic to Netscape to Netscape 2 was super fast, slowing by Netscape 3, crawling by Netscape 4 which took forever to get to a level where most people could ignore it. IE5 still does what most people want so most users only upgrade browsers when they buy new computers.
I think PHP is getting like that. Many folks who really care about the OO features in PHP5 are the sort who've switched to Ruby (I keep swearing my next project will be in Ruby...) or something like that, and PHP4 has most features that most users want, not like upgrading from PHP3 to PHP4.
At this point in time, 4.3 is a better option for production use (even if it doesn't have the OO features).
BTW, you can program in OO in PHP 4. It may be easier to do procedural style in PHP 4, but OO is certainly not impossible or hard to do.
but OO is certainly not impossible or hard to do.
It depends on what you mean. Since you can't declare properties and methods as private, classes in PHP are essentially function libraries with some built-in data.
It's useful, yes, but there's nothing to stop someone from getting and setting class variables from outside the class, which is much of the point of OO programming - the object should be a black box with a public interface that can be carefully controlled by the class designer. Lose that and you've lost much of the point.
Also, since PHP scripts are rarely distributed in a compiled state, even with PHP 5's literal visibility OO features, there is nothing to stop someone from changing your code to unprotect the "protected" properties and methods, if you are worried about protecting them for distribution.
Not knocking PHP 5 BTW, as its improvements are a nice step forward; however, if you've been designing and implementing your own classes to be better OO by concept, some of the enhancements are really a moot point.
I'm not sure if I'm allowed to mention the hosts though, so if someone could clarify, I'll gladly let you know.
[edited by: jatar_k at 11:03 pm (utc) on Aug. 7, 2005]