Jump to content

LTRIM & Rounding - how to combine syntax?


lakeshoretech

Recommended Posts

$f15 = 0.345677 (output from sql data pull)

 

<?php echo number_format ($f15,3); ?>

output = 0.345

 

<?php echo ltrim($f15,"0"); number_format ($f15,3); ?>

output = .345677

 

How do I combine these so that I am BOTH rounding the result AND trimming a leading zero?  Seems I can get one or the other, but not both.

 

Suggestions on the syntax?

 

Link to comment
https://forums.phpfreaks.com/topic/220147-ltrim-rounding-how-to-combine-syntax/
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.