note 30850 added to function.parse-str
| From: | kristoffer at rack1 dot php dot net | Date: | Tue, 01 Apr 2003 09:40:34 +0000 |
| Subject: | note 30850 added to function.parse-str | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-46056@lists.php.net to get a copy of this message | ||
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;
}
--
http://www.php.net/manual/en/function.parse-str.php
http://master.php.net/manage/user-notes.php?action=edit+30850
http://master.php.net/manage/user-notes.php?action=delete+30850
http://master.php.net/manage/user-notes.php?action=reject+30850