I have been surprised to learning that a number of my hosted sites only support 5.1.6, when my dev box is running 5.3.x. This is a huge disappointment, because I've been working with namespaces (5.3+) and other features that seem to me to be excellent, if not strictly necessary.
Anyway, when writing code that is designed to be portable (eg: plugins for popular platforms like WordPress), what version of PHP should I be targeting, based on the minimum version that's supported on the majority of web hosts out there.
Does anyone know? How can one find out?
Check
http://w3techs.com/technologies/details/pl-php/all/all
out.It contains a lot of PHP stats. As of 12 Dec 2012,
96.4%
of all the websites which use PHP.42.3%
of all the websites which use PHP version 552.8%
of all the websites which use PHP version 5When you write for a specific platform, check the system requirements of that platform. For example, Wordpress 3.1 supports PHP 4.3 and MySQL MySQL 4.1.2. The next version 3.2 will increase this to PHP 5.2.4 and MySQL 5.0. So just check the according website of the project you would like to code for.
My godaddy hosting account is on 5.2.17. If you want code to be portable then I would go with a general baseline of 5.0 features, which is pretty big feature set.