ivytony Posted February 29, 2008 Share Posted February 29, 2008 because I don't want to do this: ($n * 100) . '%'; Is there any easier way to do it? thanks! Link to comment https://forums.phpfreaks.com/topic/93629-any-function-that-can-convert-decimal-number-to-percentage-easily/ Share on other sites More sharing options...
moon 111 Posted February 29, 2008 Share Posted February 29, 2008 Not that I know of. If your going to use it often you can use this: function dectopercentage($dec, $percision = 0) { return round($dec * 100, $percision) . '%'; } Link to comment https://forums.phpfreaks.com/topic/93629-any-function-that-can-convert-decimal-number-to-percentage-easily/#findComment-479750 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.