note 94337 deleted from function.version-compare by danbrown

From: Date: Thu, 29 Oct 2009 15:10:46 +0000
Subject: note 94337 deleted from function.version-compare by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-162249@lists.php.net to get a copy of this message
Note Submitter: meitarm at gmail dot com ---- Not knowing this function existed, I wrote my own implementation of something similar. Mine differs from version_compare() in that it treats '1' as being equivalent to '1.0'. Perhaps that might be useful to someone. The full code I wrote is here: http://pastebin.com/f15172145 But here are the function signatures. <?php /** * Compares two arbitrary version strings. * * @param mixed $ver The version to test. Can be a string or array created with parse_version(). * @param string $op The comparison operation to perform. * @param mixed $num The version number to test the comparison again. Can also be a string or array. * @return mixed True or false if comparison is performed, otherwise returns an array of the passed-in version. * * @see parse_version(string $str, bool $named) */ function test_version ($ver, $op, $num) // ... /** * Parses a version number string into an array. * * @param string $str The version number to parse. * @param bool $named If true, adds extra elements to the array named "major," "minor," and "patch" for ease of use. Default is false. * @return array An object whose elements correspond to the dot-seperated version numbers. */ function parse_version ($str, $named = false) ?>

« previous php.notes (#162249) next »