Page 1 of 1

Requirements for things you will release

Posted: Sun Apr 20, 2008 6:01 pm
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?

Re: Requirements for things you will release

Posted: Sun Apr 20, 2008 6:28 pm
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
  }
}) 

Re: Requirements for things you will release

Posted: Mon Apr 21, 2008 2:41 am
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.

Re: Requirements for things you will release

Posted: Mon Apr 21, 2008 4:25 am
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.