What version of PHP is considered “Standard” for m

2019-06-23 18:35发布

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?

3条回答
家丑人穷心不美
2楼-- · 2019-06-23 18:44

Check http://w3techs.com/technologies/details/pl-php/all/all out.

It contains a lot of PHP stats. As of 12 Dec 2012,

  • Version 5 is used by 96.4% of all the websites which use PHP.
  • Version 5.3 is used by 42.3% of all the websites which use PHP version 5
  • Version 5.2 is used by 52.8% of all the websites which use PHP version 5
查看更多
萌系小妹纸
3楼-- · 2019-06-23 19:01

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.

When 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.

查看更多
Viruses.
4楼-- · 2019-06-23 19:07

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.

查看更多
登录 后发表回答