PHP中数字千分位逗号(支持自定义)分隔函数

/**
 * @method PHP中数字千分位逗号分隔函数,(php中自带函数number_format)
 * @param $strnum
 * @param string $len
 * @param string $mark
 * @return string
 */
function formatstr($strnum, $len = '3', $mark = ',')
{
    $strnum = strrev($strnum);
    $strnum = chunk_split($strnum, $len, $mark);
    $strnum = strrev($strnum);
    $strnum = ltrim($strnum);
    return $strnum;

}
Last modification:March 18th, 2019 at 01:23 pm
如果觉得我的文章对你有用,请随意赞赏

Leave a Comment