Page 1 of 1

Does this seem logical?

Posted: Sat Oct 30, 2004 1:08 am
by Jeremy
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?

Posted: Sat Oct 30, 2004 9:56 am
by kettle_drum
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.

Posted: Sat Oct 30, 2004 3:34 pm
by Christopher
It really depends on your servers. If all the servers that share the code you are developing are running PHP5 then there is no reason not to use it.

Posted: Tue Nov 02, 2004 6:16 am
by Maugrim_The_Reaper
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...

Posted: Tue Nov 02, 2004 12:05 pm
by rehfeld
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

Code: Select all

if (!function_exists('stripos')) {
    include('compat/function.stripos.php'); // and this file has a php code version of stripos
}
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.