Created
January 10, 2017 06:00
-
-
Save scofennell/166520c3e0beb59fae9ccd2f19a8da09 to your computer and use it in GitHub Desktop.
Compare two version numbers in php.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Determine if this asset needs to be updated. | |
* | |
* @return boolean Returns TRUE of the local version number | |
* is lower than the remote version number, else FALSE. | |
*/ | |
function needs_update() { | |
$old_version = $this -> old_version; | |
$new_version = $this -> new_version; | |
$compare = version_compare( $old_version, $new_version ); | |
if( $compare == -1 ) { return TRUE; } | |
return FALSE; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment