-
-
Save l3ikrant/996674d8998e43adcadf755e41c89fb9 to your computer and use it in GitHub Desktop.
Validate geo coordinate
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
| /** | |
| * 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; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment