php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Return to Bug #79471
Patch number_format_trim revision 2020-04-13 09:50 UTC by festuc at lestudi dot com

Patch number_format_trim for Strings related Bug #79471

Patch version 2020-04-13 09:50 UTC

Return to Bug #79471 | Download this patch
Patch Revisions:

Developer: festuc@lestudi.com

function number_format_trim($value,$maxdecimal=0,$decimalsing='.',$thousandsing=','){
	if (is_numeric($value)){
		$value=number_format($value,$maxdecimal,'.','');//to change input type to string
		$i=-1;
		if (strpos($value,'.'))while (substr($value,$i)==0){
			$i--;
			$maxdecimal--;
		}
		else $maxdecimal=0;
		return number_format($value,$maxdecimal,$decimalsing,$thousandsing);
	}
}
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 25 09:01:29 2024 UTC