Skip to content

Instantly share code, notes, and snippets.

@relliv
Last active April 28, 2018 18:07
Show Gist options
  • Save relliv/de97172a6a2cf04dbe99a54794c2016b to your computer and use it in GitHub Desktop.
Save relliv/de97172a6a2cf04dbe99a54794c2016b to your computer and use it in GitHub Desktop.
PHP Basic Update Check Example
<?php
// app current version
$appversiyon = "2.2";
if($_GET["version"]){
// GET client vresion
$client_version = $_GET["version"];
// compare with app version
if($appversiyon > $client_version){
// if client version is lower, say OK for updates
echo "OK";
}
// if app version is lower, say RETURN
else if($appversiyon < $client_version){
echo "RETURN";
}
// if they are equals
else if($appversiyon == $client_version){
// there is no update
echo "NO";
}
}
?>
  • make a web request like this url: https://domain .com/updatecheck.php?version={CLIENT_VERSION}
  • version parameter must int or double eg: 1,22,13,40 or 1.2.3.4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment