Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7564107
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T13:50:00+00:00 2026-05-30T13:50:00+00:00

This question title is a bit longer than what I intended, but I’m wondering

  • 0

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.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T13:50:01+00:00Added an answer on May 30, 2026 at 1:50 pm

    If I had to format the values as a number, my choice would be %F:

    F – the argument is treated as a float, and presented as a floating-point number (non-locale aware). Available since PHP 4.3.10 and PHP 5.0.3.

    A non-locale aware representation is necessary because otherwise, the european representation would look like xx,xxxxxx for 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.)

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

The title of this question is a bit misleading, but I couldn't summarize this
The title of this question might be a bit off but its the closest
I know the title of this question is a bit confusing, but here it
This question is a bit different than most. My code works but I don't
This question is a bit of a two-parter. First, the title question. Here's what
i didn't really know how to title this question, but here's a thing that
I have no good title for this question, but my problem is to set
The title is a bit difficult to put together for this question. Say I
The title of this question may be a bit misleading. I couldn't quite think
the question title might be a bit confuse. but here is my case. i

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.