Does this seem logical?

Ye' old general discussion board. Basically, for everything that isn't covered elsewhere. Come here to shoot the breeze, shoot your mouth off, or whatever suits your fancy.
This forum is not for asking programming related questions.

Moderator: General Moderators

Post Reply
User avatar
Jeremy
Forum Newbie
Posts: 3
Joined: Fri Aug 20, 2004 9:45 pm
Location: Alabama, USA

Does this seem logical?

Post 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?
kettle_drum
DevNet Resident
Posts: 1150
Joined: Sun Jul 20, 2003 9:25 pm
Location: West Yorkshire, England

Post 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.
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Post 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.
(#10850)
User avatar
Maugrim_The_Reaper
DevNet Master
Posts: 2704
Joined: Tue Nov 02, 2004 5:43 am
Location: Ireland

Post 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...
rehfeld
Forum Regular
Posts: 741
Joined: Mon Oct 18, 2004 8:14 pm

Post 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.
Post Reply