Skip to content

Instantly share code, notes, and snippets.

View l3ikrant's full-sized avatar

Bikrant Giri l3ikrant

View GitHub Profile
@l3ikrant
l3ikrant / coordinateValidator.php
Created June 28, 2017 15:30 — forked from anonymous/coordinateValidator.php
Validate geo coordinate
/**
* 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;
}