public function parse($coord) {
        $coordinate = null;
        $matches = array();
        preg_match($this->input_format, $coord, $matches);
        if (count($matches) == 5) {
            $degrees = $matches[1];
            $minutes = $matches[2] * (1 / 60);
            $seconds = $matches[3] * (1 / 60 * 1 / 60);

            $coordinate = '';
            if (isset($matches[4])) {
                if ($matches[4] == 'S' or $matches[4] == 'W') {
                    $coordinate = '-';
                }
            }

            $coordinate .= $degrees + $minutes + $seconds;
        }
        if (is_numeric($coordinate)) {
            return deg2rad((float) $coordinate);
        }
        throw new E\InvalidCoordinateFormatException('The format of "' . $coord . '" cannot be parsed');
    }
public function parse($coord) {
        $coordinate = null;
        $matches = array();
        preg_match($this->input_format, $coord, $matches);
        if (count($matches) == 5) {
            $degrees = $matches[1];
            $minutes = $matches[2] * (1 / 60);
            $seconds = $matches[3] * (1 / 60 * 1 / 60);

            $coordinate = '';
            if (isset($matches[4])) {
                if ($matches[4] == 'S' or $matches[4] == 'W') {
                    $coordinate = '-';
                }
            }

            $coordinate .= $degrees + $minutes + $seconds;
        }
        if (is_numeric($coordinate)) {
            return deg2rad((float) $coordinate);
        }
        throw new E\InvalidCoordinateFormatException('The format of "' . $coord . '" cannot be parsed');
    }
public function parse ( $ coord ) { $ coordinate = null ; $ matches = array ( ) ; preg_match ( $ this -> input_format , $ coord , $ matches ) ; if ( count ( $ matches ) == 5 ) { $ degrees = $ matches [ 1 ] ; $ minutes = $ matches [ 2 ] * ( 1 / 60 ) ; $ seconds = $ matches [ 3 ] * ( 1 / 60 * 1 / 60 ) ; $ coordinate = '' ; if ( isset ( $ matches [ 4 ] ) ) { if ( $ matches [ 4 ] == 'S' or $ matches [ 4 ] == 'W' ) { $ coordinate = '-' ; } } $ coordinate .= $ degrees + $ minutes + $ seconds ; } if ( is_numeric ( $ coordinate ) ) { return deg2rad ( ( float ) $ coordinate ) ; } throw new E \ InvalidCoordinateFormatException ( 'The format of "' . $ coord . '" cannot be parsed' ) ; }
Used when setting a value in the Coordinate class.
@example parse('10° 5\' 30"N');
@example parse('10 5 30N');
@param string $coord
@return float
Used when setting a value in the Coordinate class .