note 92935 deleted from function.version-compare by googleguy

From: Date: Tue, 22 Oct 2013 11:15:49 +0000
Subject: note 92935 deleted from function.version-compare by googleguy
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-197050@lists.php.net to get a copy of this message
Note Submitter: Sina Salek ---- Sometimes the code is forward compatible, for example when the code is compatible with all future PHP5 releases. This function supports .x, for the above example it's : 5.x <?php function versionCompare($version1,$version2,$operand) { $v1Parts=explode('.',$version1); $version1.=str_repeat('.0',3-count($v1Parts)); $v2Parts=explode('.',$version2); $version2.=str_repeat('.0',3-count($v2Parts)); $version1=str_replace('.x','.1000',$version1); $version2=str_replace('.x','.1000',$version2); return version_compare($version1,$version2,$operand); } ?> --- Sina Salek http://sina.salek.ws/en/contact

« previous php.notes (#197050) next »