Posted By

on 04/29/09


Tagged

decimal round


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

Dean_IconWeb


Redondear y transformar a Decimal


 / Published in: PHP
 

URL: http://prajapatinilesh.wordpress.com/2007/09/20/php-round-off-decimal-or-convert-to-decimal-point/

Nada del otro mundo pero quiero tener ejemplos aca en snipplr :D

  1. Round Off Decimal
  2. Round a number up or down or Round off a floating decimal point number using PHP�s functions round().
  3. Example. round();
  4. echo round(3.4); // 3
  5. echo round(3.5); // 4
  6. echo round(3.6); // 4
  7. echo round(3.6, 0); // 4
  8. echo round(1.95583, 2); // 1.96
  9. echo round(1241757, -3); // 1242000
  10. echo round(5.045, 2); // 5.05
  11. echo round(5.055, 2); // 5.06
  12.  
  13. Convert to Decimal Point
  14. Example. number_format();
  15. $number = �28�;
  16. $number = number_format($number, 2);
  17. echo $number; // equals �28.00�

Report this snippet  

You need to login to post a comment.