title: converting GPS latitude/longitude from different formats to one format (in PHP)
body: <p>i'm trying to built in support for locations in my application and i'm expecting users to be inputting gps coordinates in a variety of ways. I need to convert all of the below to: latitude - direction (N/s), degres, minutes, seconds; longitude (E/W) - degrees, minuts, seconds.</p>
  
  <p>Note, each user input will be in a single line. I would like my users to input only in one single way, but ppl will definitely enter as one of the following...:</p>
  
  <p>eg: 
  9.182, -39.140625<br>
  9.182 / -39.140625<br>
  9.182,-39.140625<br>
  9.182 -39.140625<br>
  21° 16' 674S[some_separator]27° 30' 318E<br>
  21 16 674S[some_separator]27 30 318E<br></p>
  
  <p>[some_separator] may be a single space as well...</p>
  
  <p>The final format needs to beas:<br>
  latitude.direction = south<br>
  latitude.degrees = 21<br>
  latitude.minutes = 16<br>
  latitude.seconds = 674<br>
  longitude.direction = east<br>
  longitude.degrees = 27<br>
  longitude.minutes = 30<br>
  longitude.seconds = 318<br></p>
  
  <p>(a) what is the simplest way of asking ordinary-non-tech users to input the GPS coordinate?s<br>
  (b) how do i convert the above to the final format? any built in functions that handle these variations in data input?</p>
  
  <p>i've seen <a href="https://stackoverflow.com/questions/2548943/gps-format-in-php">GPS format in PHP</a> - but i need to handle a more varied input.</p>