Simple function to convert an integer to a price.

1
2
3
4
5
6
7
8
9
10
11
function convert_int_to_price($price)
{
  $p = strrev($price);
  $count = 3;
  while ($count < strlen($p))
  {
    $p = substr_replace($p, ",", $count, 0);
    $count = $count+4;
  }
  return strrev($p);
}