Smart Percentage


/ Published in: PHP
Save to your folder(s)



Copy this code and paste it in your HTML
  1. function smartPerc($num)
  2. {
  3. return (( $num - ( int ) $num ) > 0.0) ? number_format( $num, 2, '.', '' ) : (int) $num;
  4. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.