note 30850 deleted from function.parse-str by nlopess
| From: | nlopess@php.net | Date: | Sat, 13 Mar 2004 21:35:57 +0000 |
| Subject: | note 30850 deleted from function.parse-str by nlopess | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-66792@lists.php.net to get a copy of this message | ||
Note Submitter: kristoffer at caveo dot se
----
For printing int´s as prices for use in webshops and more, here´s a bit nasty/dirty function for
it.
Sorry about the whitespaces, but tabs didnt show up on the preview.
function parsePrice($int)
{
$j = 0;
$r = strlen($int);
$rint = strrev($int);
if ($r > 3)
{
for ($i = 0; $i < $r;$i++)
{
$n = $rint[$i];
if ($j == 3)
{
$price .= ".";
$j = 0;
}
$price .= $n;
$j++;
}
}
else
{
$price = $int;
}
$price = strrev($price);
$price .= ",00";
return $price;
}