note 91290 deleted from function.strlen by danbrown
| From: | danbrown@php.net | Date: | Thu, 04 Jun 2009 12:40:02 +0000 |
| Subject: | note 91290 deleted from function.strlen by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-156355@lists.php.net to get a copy of this message | ||
Note Submitter: raphaeldumonte at yahoo dot com
----
Here is a function (int__) that will allow you to change an integer (e.g. 10000) into a comma-ized
format. lol. (e.g. 10,000)
Works fine with me... If someone can clarify what i was able to do, I'd be very happy.
function reverse_string($str){
$a = strlen($str);
str_split($str);
for ($b = $a; $b >= 0; $b--){
$return = $return.$str[$b];
}
return $return;
}
function int__($i){
$a = strlen($i);
$i = reverse_string($i);
str_split($i);
for ($b = $a; $b > 0; $b--){
$c = $b % 3;
if ($c == 0 && $b != ($a) && $b != ($a - 1))$val = $val.",";
$val = $val.$i[$b];
}
//$val = reverse_string($val);
return $val;