Skip to content

Instantly share code, notes, and snippets.

@wescleymatos
Created June 25, 2012 14:05
Show Gist options
  • Save wescleymatos/2988844 to your computer and use it in GitHub Desktop.
Save wescleymatos/2988844 to your computer and use it in GitHub Desktop.
convert mysql decimal(10,2) in money brazil(R$)
<?php
//Converte de R$ para decimal(10,2)
//$value = 150.000,00
$value = str_replace('.','',$value);
$value = str_replace(',','.',$value);
echo $value; //150000.00
//Converter de decimal(10,2) para R$
//$value = 150000.00
$value = number_format($value,2,',','.');
echo $value; //150.000,00
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment