note 67922 deleted from function.version-compare by jacques
| From: | jacques@php.net | Date: | Sat, 13 Jan 2007 18:49:29 +0000 |
| Subject: | note 67922 deleted from function.version-compare by jacques | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-121600@lists.php.net to get a copy of this message | ||
Note Submitter: elmuerte
----
It's best to always convert spaces to a dash or a dot because the version compare doesn't
always behave as expected with spaces:
<?php
version_compare("1.0.0.0 beta 1", "1.0.0.0 alpha 2") == -1; // this is clearly
wrong
version_compare("1.0.0.0-beta 1", "1.0.0.0-alpha 2") == 1;
version_compare("1.0.0.0.beta 1", "1.0.0.0.alpha 2") == 1;
version_compare("1.0.0.0.beta.1", "1.0.0.0.alpha.2") == 1;
?>
(PHP 4.3.10)