Jump to content

sprintf help


EY

Recommended Posts

Alright i got a question about sprintf:

 

 

$price = 25;
$f_price = sprintf(“%01.2f”,$price);
echo “$f_price”;

 

So what this means is i name a variable like i would always

$price = 25;

 

Now what i need explanation is with

$f_price 

   

Do i just choose any other variable and put it there/. Can anyone explain the function of that being there.

 

 

And this piece of code is always the same right?

 sprintf("%01.2f"

And at the end i put ,and the variable i choose in first place.

 

 

Please tell me if this is right and also about the part i do not understand.

Thanks in advance.

Link to comment
https://forums.phpfreaks.com/topic/95524-sprintf-help/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.