I'm assuming every modern hosting provider gives access to php5 (and i noticed that many have both 4 and 5) but now WHICH php5 is most popular... let's say i'm trying to choose between curl copy handle and curl setopt array (in my previous question)... but curl setopt array is available in php 5.1.3 while curl copy handle is available in earlier versions... so now how do i know if it's worthwile to use thing that works with newer version? How do i know if php 5.1.3 is used widely enough? I'm trying to make my application run on most configurations available.
views:
74answers:
3Is it possible to determine which php version is most widely used on paid webhosting services?
According to this website, the most popular version of PHP on May 9, 2008 (over a year ago) was PHP 5.2.5. So, you'd probably be OK using 5.1.3 + features.
Use the function_exists
method to check for which function exists, then use that one. That way you don't have to worry about which version of PHP is being used. It's the same idea as the feature-detection vs browser-detection debate in javascript.
Besides what tj111 mentioned, the PHP version doesn't really mean which functions will or will not be available. Many hosts, specially free hosts, disable features like cURL, mail(), ZipArchive, image* functions, system(), exec(), passthru() etc. If you want to check for dependences, its recommended to check for exactly what you need with function_exists().