phpjs
Version:
39 lines (27 loc) • 1.66 kB
HTML
<!-- Generated by Rakefile:build -->
<strong>
<a href="http://an3m1.com/" rel="nofollow"> ????? ????? ????</a>
</strong>
on 2012-04-17 15:29:36 <br />
This is a very informative article. I was looking for these things and here I found it. I am doing a project and this information is very useful me. Some things in here I have not thought about before
<hr />
<strong>
</strong>
on 2010-05-30 01:30:40 <br />
@Scott Baker: Thank you for finding this. I fixed this and went ahead and fixed a few other bugs I found in this function (you can never be too nit picky), including:
- An empty string is acceptable as a version number. (Currently throws an error.) An empty string should always be less-than a non-empty string (PHP behavior).
- Both the operators and the version words were being treated as case-insensitive when PHP treats them as case-sensitive.
- An invalid operator should make the function return null instead of using the "<" operator as a fallback.
The code has also been reduced by many lines and documented better. You can get the updated code here http://github.com/kvz/phpjs/raw/master/functions/info/version_compare.js before it is updated on the main website.
<hr />
<strong>
<a href="http://www.perturb.org" rel="nofollow">Scott Baker</a>
</strong>
on 2010-05-28 23:51:20 <br />
This may be nit picky, but I've seen version numbers with leading zeros as filler. This breaks this compare.
Correct:
<pre><code>version_compare('4.1.0.52','4.1.0.52') = 0</code></pre>
Not Correct:
<pre><code>version_compare('4.1.0.52','4.01.0.51') = 0
version_compare('4.1.0.52','4.01.0.51','>') = false</code></pre>
<hr />