Skip to content

Instantly share code, notes, and snippets.

@alixaxel
Created September 8, 2011 17:01
Show Gist options
  • Save alixaxel/1203922 to your computer and use it in GitHub Desktop.
Save alixaxel/1203922 to your computer and use it in GitHub Desktop.
<?php
function Coordinates()
{
if (count($arguments = func_get_args()) > 1)
{
foreach ($arguments as $key => $value)
{
$arguments[$key] = sprintf('%04s', ph()->Math->Base(10, 62, round($value + 180, 4) * 10000));
}
return implode('', $arguments);
}
else if (count($result = str_split(ph()->Value($arguments, 0), 4)) >= 2)
{
foreach ($result as $key => $value)
{
$result[$key] = ph()->Math->Round(ph()->Math->Base(62, 10, $value) / 10000 - 180, 4);
}
return $result;
}
return false;
}
ph()->Dump(Coordinates('9hR67ce2'));
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment