<?php
function get_coordinates_array($entity_gps) {
'/([NSWE])(\\d{1,2})[^\\d](\\d{1,2})[^\\d]([\\d\\.]{1,10})[^\\d\\s]/ui',
$entity_gps, $items, PREG_SET_ORDER);
if ($res === 2) {
);
} else {
return null;
}
}
//testando
$entity_gps = 'N40°11\'43.44" W8°25\'1.31"';
$coordinatesArr = get_coordinates_array($entity_gps);
echo $entity_gps . "\n";
echo 'Entrada inválida!';
} else {
}
PD9waHAKCmZ1bmN0aW9uIGdldF9jb29yZGluYXRlc19hcnJheSgkZW50aXR5X2dwcykgewoJJGl0ZW1zID0gYXJyYXkoKTsKCSRyZXMgPSBwcmVnX21hdGNoX2FsbCgKCQknLyhbTlNXRV0pKFxcZHsxLDJ9KVteXFxkXShcXGR7MSwyfSlbXlxcZF0oW1xcZFxcLl17MSwxMH0pW15cXGRcXHNdL3VpJywgCgkJJGVudGl0eV9ncHMsICRpdGVtcywgUFJFR19TRVRfT1JERVIpOwoJaWYgKCRyZXMgPT09IDIpIHsKCQlyZXR1cm4gYXJyYXkoCgkJCSJsYXQiID0+IGFycmF5X3NsaWNlKCRpdGVtc1swXSwgMSwgNCksCgkJICAgICJsbmciID0+IGFycmF5X3NsaWNlKCRpdGVtc1sxXSwgMSwgNCkKCQkpOwoJfSBlbHNlIHsKCQlyZXR1cm4gbnVsbDsKCX0KfQoKLy90ZXN0YW5kbwokZW50aXR5X2dwcyA9ICdONDDCsDExXCc0My40NCIgVzjCsDI1XCcxLjMxIic7CiRjb29yZGluYXRlc0FyciA9IGdldF9jb29yZGluYXRlc19hcnJheSgkZW50aXR5X2dwcyk7CmVjaG8gJGVudGl0eV9ncHMgLiAiXG4iOwppZiAoaXNfbnVsbCgkY29vcmRpbmF0ZXNBcnIpKSB7CgllY2hvICdFbnRyYWRhIGludsOhbGlkYSEnOwp9IGVsc2UgewoJcHJpbnRfcigkY29vcmRpbmF0ZXNBcnIpOwp9Cg==