Requirements for things you will release

Not for 'how-to' coding questions but PHP theory instead, this forum is here for those of us who wish to learn about design aspects of programming with PHP.

Moderator: General Moderators

Post Reply
toasty2
Forum Contributor
Posts: 361
Joined: Wed Aug 03, 2005 10:28 am
Location: Arkansas, USA

Requirements for things you will release

Post by toasty2 »

I'm working on a project that uses parts of PHP available in 5, specifically 5.1. Should I use things available in new versions? What balance between using new features and limiting yourself to old is a good idea? I don't want to make things extremely hard for myself to code by sticking with old stuff, but I want my projects to appeal to wide(-ish) audiences...What do you do? Should I even care about PHP4 since 5 has been out for over 2 years now?
User avatar
Kieran Huggins
DevNet Master
Posts: 3635
Joined: Wed Dec 06, 2006 4:14 pm
Location: Toronto, Canada
Contact:

Re: Requirements for things you will release

Post by Kieran Huggins »

It's a constant trade-off - I'd feel comfortable requiring php5 unless compatibility is trivial to achieve.

function_exists() is your friend in those cases:

Code: Select all

if(!function_exists('some_php5_function'){
  function some_php5_function($args){
    //replacement legacy workaround code
  }
}) 
User avatar
onion2k
Jedi Mod
Posts: 5263
Joined: Tue Dec 21, 2004 5:03 pm
Location: usrlab.com

Re: Requirements for things you will release

Post by onion2k »

Depends on who you want to use your code. If you want the widest audience possible then you'll need to support PHP4 because there are lots of people who won't upgrade.

That said though I'm of the opinion that open source projects that continue to support PHP4 are actually damaging PHP's audience. It's time to move on to 5, and the more reasons people have to upgrade the better. If a particular piece of software isn't available on 4 then they'll have to make a choice to either switch to 5 or use a different application. If we write best-in-class software that only works in 5 then everyone will make the sensible choice.
User avatar
Chris Corbyn
Breakbeat Nuttzer
Posts: 13098
Joined: Wed Mar 24, 2004 7:57 am
Location: Melbourne, Australia

Re: Requirements for things you will release

Post by Chris Corbyn »

onion2k wrote:That said though I'm of the opinion that open source projects that continue to support PHP4 are actually damaging PHP's audience. It's time to move on to 5, and the more reasons people have to upgrade the better. If a particular piece of software isn't available on 4 then they'll have to make a choice to either switch to 5 or use a different application. If we write best-in-class software that only works in 5 then everyone will make the sensible choice.
100% agree with this. I've seen a lot of open source projects dropping PHP4 support since December. Hopefully that number will increase. Next we'll have a PHP5/6 divide though ;) Well, no actually I suspect PHP6 will be the next "widely used" PHP version given the unicode changes. We're a funny bunch for being so stuck in the past -- cPanel is a lot to blame.
Post Reply