Posted By

giak on 01/14/10


Tagged

round percent


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

4rp70x1n


PHP : percent an INT


 / Published in: PHP
 

URL: http://www.giacomel.fr

  1. // cross product
  2. function neo_percent($total, $rapport){
  3. if($total > 0){
  4. $percent = ( 100 * $rapport) / $total ;
  5. }else{
  6. $percent = 0;
  7. }
  8. return round($percent,2);
  9. }

Report this snippet  

You need to login to post a comment.