Question

In PHP's version_compare function, pl or p are the only strings in a version number that are evaluated to be later than the numbered versions. Which means that when comparing version numbers,

1.5 < 1.6-beta < 1.6 < 1.6.1 < 1.6-pl

My question is, what does pl or p stand for in this context?

Était-ce utile?

La solution

p and pl stand for "patch" or "patch level."

The example version numbers that I gave in the question highlight a bit of a quirk with using PHP's version_compare function. Most strings are evaluated lower than a number, and the absence of a number (such as the third position in 1.6) is evaluated to the number 0. However, p and pl are evaluated higher than a number. Therefore, if you start with version 1.6, and you'd like to release a patch version for 1.6 with the intent of releasing 1.6.1 in the future, your patched version should be labeled 1.6.0-pl. Otherwise, 1.6.1 will be seen as older than 1.6-pl.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top