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

  • SEARCH
  • Home
  • 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 8137441
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T11:07:16+00:00 2026-06-06T11:07:16+00:00

Is there any benefit to include the length specifier in a format string for

  • 0

Is there any benefit to include the length specifier in a format string for sprintf or printf even though it’s not mentioned in the PHP manual:

  • h – The argument is interpreted as a short int or unsigned short int (only applies to integer specifiers: i, d, o, u, x and X).
  • l – The argument is interpreted as a long int or unsigned long int for integer specifiers (i, d, o, u, x and X), and as a wide character or wide character string for specifiers c and s.
  • L – The argument is interpreted as a long double (only applies to floating point specifiers: e, E, f, g and G).

Or is it better to leave it out? I guess what I’m trying to figure out is why php decided to leave it out.

Consider the following code, which comes from phpriot.com:

$a = 0.5;
$b = 0.1;
$c = 16;

echo sprintf('%01.2lf %.1lf 0x%x', $a, $b, $c); # 0.50 0.1 0x10






 
  • 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-06-06T11:07:17+00:00Added an answer on June 6, 2026 at 11:07 am

    In PHP there are no differentiation between numbers except for Integers and Floats. Depending on system architecture, 32 or 64-bit, the Integer type is a int or int64. You can use strings and BCMath to imitate larger numbers, but they’ll always be stored in strings.

    So in PHP there’s no purpose to have a length specifier to change the type of the number. Either it’s a float, or it’s not.

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

Sidebar

Related Questions

Is there any benefit in salting passwords for a strong, unique (not used for
In asp.net is there any benefit to including or not including an id property?
I there any benefit to putting the javascript references in individual pages vs the
Is there any benefit (or conversely, cost) to passing a parameter by const value
When using Google app engine is there any benefit to use a CDN if
Possible Duplicate: C# member variable initialization; best practice? Is there any benefit to this:
Is there any performance benefit/technical differences between calling EF SaveChanges() in a foreach loop
Are there any benefit in me drawing my own buttons (just rectangles) over loading
Is there any benefit to using .click() over .bind('click') or vice-versa besides the amount
Is there any benefit to running an UPDATE Statistics after you create an index

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.