Does this seem logical?
Moderator: General Moderators
Does this seem logical?
Been working with PHP for quite some time now... PHP5 is out, and I want to utilize all of the improvements with OOP, and such, but a lot of these things are not backwards-compatible with PHP4. Does it seem logical to start programming for just PHP5, or do you believe that it has not become mainstream enough for it to be effective?
-
kettle_drum
- DevNet Resident
- Posts: 1150
- Joined: Sun Jul 20, 2003 9:25 pm
- Location: West Yorkshire, England
Well it depends on what your developing. If your developing for a client and their not using php 5 then dont do it. If your begining to code a project that will take you 12 months and would benifit from OO then use php 5 (php 5 will be more wide-spread by the time you release your work).
You need to use what is good for you, and in most cases that is simply using whatever you have on your server. But by all means begin to code using the OO stuff in php 5 so that you learn it for the time when it is mainstream.
You need to use what is good for you, and in most cases that is simply using whatever you have on your server. But by all means begin to code using the OO stuff in php 5 so that you learn it for the time when it is mainstream.
- Christopher
- Site Administrator
- Posts: 13596
- Joined: Wed Aug 25, 2004 7:54 pm
- Location: New York, NY, US
- Maugrim_The_Reaper
- DevNet Master
- Posts: 2704
- Joined: Tue Nov 02, 2004 5:43 am
- Location: Ireland
It depends entirely on the penetration of PHP5 - which not likely to be huge for quite a while.
I'd suggest remaining aware of the PHP5 issues, but retaining compatibility with PHP4. Keep all this in mind and you might be able to structure your code to enable a switchover when PHP5 is widely accepted by hosts...
I'd suggest remaining aware of the PHP5 issues, but retaining compatibility with PHP4. Keep all this in mind and you might be able to structure your code to enable a switchover when PHP5 is widely accepted by hosts...
you might want to take a look at php_compat
its a pear release that tries to make php4 compatible w/ php5 code.
i dont think it can do anything about the new OO stuff, but it can allow you to freely use most of the php5 functions(which can save you a lot of time coding)
it works something like this
it does that for (almost all i think) of the php5 only funcitons.
drawback is this will greatly increase the amount of code php must load and parse every time its executed
you could of course only have it check and load the functions you commonly use, which would cut down on unneccesary function defining a lot.
ive still found php5 hosting to be scarce. ive asked a few hosts and they all seem scared to upgrade because they dont want to break thier current customers code, which is extremely understandable for a host. like said above, php5 will probably not be mainstream for quite a while, espescially since php4 works so good(if it aint broke dont fix it)
but i would definately try to use php5, if its a viable option.
its a pear release that tries to make php4 compatible w/ php5 code.
i dont think it can do anything about the new OO stuff, but it can allow you to freely use most of the php5 functions(which can save you a lot of time coding)
it works something like this
Code: Select all
if (!function_exists('stripos')) {
include('compat/function.stripos.php'); // and this file has a php code version of stripos
}drawback is this will greatly increase the amount of code php must load and parse every time its executed
you could of course only have it check and load the functions you commonly use, which would cut down on unneccesary function defining a lot.
ive still found php5 hosting to be scarce. ive asked a few hosts and they all seem scared to upgrade because they dont want to break thier current customers code, which is extremely understandable for a host. like said above, php5 will probably not be mainstream for quite a while, espescially since php4 works so good(if it aint broke dont fix it)
but i would definately try to use php5, if its a viable option.