SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Evangelist
    Join Date
    Mar 2011
    Posts
    423
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    What is: sprintf("%01.2f"?

    Hi,

    I am editing a basket. The code where it gets the amount the customer is paying is:

    PHP Code:
    $ThisAmount sprintf("%01.2f",$_REQUEST['amount'] + $postage); 
    What does sprintf("%01.2f" mean? As far as I understand all I need is:


    PHP Code:
    $ThisAmount = ($_REQUEST['amount'] + $postage); 
    Why do I need sprintf("%01.2f" ???

    Matt.

  2. #2
    Non-Member
    Join Date
    Apr 2011
    Location
    no fixed address
    Posts
    851
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by MatthewBOnline View Post
    What does sprintf(".2f" mean?
    Read This For More info on sprintf


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •