This question title is a bit longer than what I intended, but I’m wondering what’s the best % character to use for sprintf, for something like this:
sprintf("Show lat=%f AND lng=%f",$lat,$lng)
Where $lat and $lng are latitude and longitude coordinate values (respectively) that are parsed into variables from $_REQUEST, i.e.:
$lat = $_REQUEST['lat']; $lng = $_REQUEST['lng'];
Sample values are: test.php?lat=37.8019444&lng=-122.4327778
As mentioned below, the type specifiers for sprintf are indeed listed in the manual, but for someone who is not familiar with the type specifiers, the parameter descriptions are very confusing… which is why I am asking the question here.
If I had to format the values as a number, my choice would be
%F:A non-locale aware representation is necessary because otherwise, the european representation would look like
xx,xxxxxxfor example – quite possibly breaking the value for your intended purpose.That said, I’m not sure whether it’s wise to format these values at all. Depending on what you’re going to use them for, it might make sense to just pass them through as strings (after escaping them against SQL injection, of course.)