Skip to content

Instantly share code, notes, and snippets.

Created April 11, 2014 09:43
Show Gist options
  • Select an option

  • Save anonymous/10454111 to your computer and use it in GitHub Desktop.

Select an option

Save anonymous/10454111 to your computer and use it in GitHub Desktop.

Revisions

  1. @invalid-email-address Anonymous created this gist Apr 11, 2014.
    14 changes: 14 additions & 0 deletions coordinateValidator.php
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,14 @@
    /**
    * Checks given coordinate for errors
    * @param float $coordinate coordinate
    *
    * @return bool result
    */
    public function checkCoordinate($coordinate) {
    if(preg_match('/^[-]?(([0-8]?[0-9])\.(\d+))|(90(\.0+)?);[-]?((((1[0-7][0-9])|([0-9]?[0-9]))\.(\d+))|180(\.0+)?)$/', $coordinate)) {
    return true;
    }
    else {
    return false;
    }
    }