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?
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
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With