note 10207 rejected and deleted from sprintf by jmoore
| From: | jmoore@php.net | Date: | Tue, 19 Dec 2000 22:53:02 +0000 |
| Subject: | note 10207 rejected and deleted from sprintf by jmoore | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-8920@lists.php.net to get a copy of this message | ||
Can srintf do the following?
// Return Prices Pointed:
// 1234,556 -> 1.234,55
function rpp($val)
{ $comma=strpos($val,",");
if ($comma!=0)
{ $ta=substr($val,0,$comma);
$b=substr($val,$komma+1,2);
// cutted 2 digits!
} else
{ $ta=$val;
$b="00";
} // if
$a=substr(strrev(chunk_split(strrev($ta),3,".")),1);
return "$a,$b";
} // rpp