Created
June 4, 2014 18:18
-
-
Save taichunmin/c131de987a999b8f354f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function tai_moneyFormat($money) | |
{ | |
$res = ''; | |
$money = ''.$money; | |
for( $i=strlen($money)-1,$j=0; $i>=0; $i--,$j++) | |
{ | |
$res .= $money[$i]; | |
if($j%3==2 && $i>0) $res.=','; | |
} | |
return strrev($res); | |
} | |
//echo tai_moneyFormat(10000002); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment