Well, in the spirit of PHP, let's make version_compare_fixed()!
On Jul 20, 2012 1:41 PM, "Rasmus Schultz" <ras...@mindplay.dk> wrote:

> From the comments in the documentation, it seems others are having the same
> problem with version_compare() that I was running into:
>
> http://us2.php.net/version_compare
>
> Look at all those code-samples and "extensions" to the function - I found
> it very odd that the documentation does not explain how an "empty"
> version-number is interpreted compared to the strings and numbers, which
> are clearly defined and explained.
>
> For example, I was not the only one who found it odd that "1.0" is
> considered less than "1.0.0" - wouldn't it make sense to "pad" the shortest
> version-number with zeroes? e.g. "1.0" if compared against "1.0.0" would be
> padded with zeroes at the end, e.g. as "1.0.0".
>
> Of course that would break backwards compatibility, which kind of defeats
> the purpose of having a standardized version-number comparison standard.
> But as you can see, people aren't using the function as-is anyway - they're
> writing their own...
>
> - Rasmus Schultz
>

Reply via email to