PHP版本如何编号?

I am looking to upgrade WordPress on my server. WordPress 3.2 requires PHP 5.2.4 or greater. My server is running PHP 5.2.17. Looking at the release history on php.net, I see that:

  1. 5.2.4 was released 30 August 2007
  2. There is no listing for 5.2.17
  3. 5.2.16 was released 16 December 2010
  4. Release order with a few versions goes: 5.2.13, 5.3.2, 5.2.14, 5.3.3, 5.2.15

Two questions:

  • What is the logic of this numbering system?
  • Is PHP 5.2.17 "greater" than 5.2.4?

In short,

  • 5.3.x > 5.2.y
  • 5.2.(z+1) > 5.2.(z)

You can also expect periodical maintenance releases on both 5.2 and 5.3. This is why you can see 5.2.x releases appearing after 5.3.y releases.

Hope that helps,

The last number in the version string (so 4, 16, etc) is for minor releases such as bugfixes or quick security patches. The middle number is for more significant releases containing a lot of new functionality, fixed bugs, security patches and the like. The remaining 5 is for massive releases that may have been the result of an entire rewrite (unlikely), or something of that magnitude.

You are correct in saying PHP 5.2.17 is newer than 5.2.4; common sense dictates that 17 is greater than 4. You'll be fine if you install Wordpress on a 5.2.17 installation.

The most recent versions in the 5.2 and 5.3 branches are listed on http://www.php.net/downloads.php That's where your 5.2.17 is listed. PHP uses the common "change significance" system: [major].[minor].[maintenance]. More specifically, PHP has its own version comparison function: version_compare()

It works like this:

The function first replaces _, - and + with a dot . in the version strings and also inserts dots . before and after any non number so that for example '4.3.2RC1' becomes '4.3.2.RC.1'. Then it splits the results like if you were using explode('.', $ver). Then it compares the parts starting from left to right. If a part contains special version strings these are handled in the following order: any string not found in this list < dev < alpha = a < beta = b < RC = rc < # < pl = p. This way not only versions with different levels like '4.1' and '4.1.2' can be compared but also any PHP specific version containing development state.