A
Anonymous
Guest
Hello everyone.
How can I make a number given from a user to look like price?
The output of the script below is 45.678912.45678.912.4567891226 if the $drx parameter is 12345678.
How can I make a number given from a user to look like price?
The output of the script below is 45.678912.45678.912.4567891226 if the $drx parameter is 12345678.
Code:
$workStr=''.$drx;
$drxoutput=$workStr.substr(0,$workStr);
$dNum=$workStr-0;
if ($dNum>=1000) {
$dLen=count($drxoutput);
$drxoutput=''.($dNum/1000).'.'.$drxoutput.substr($dLen-3,$dLen);
}
if ($dNum>=1000000) {
$dLen=count($drxoutput);
$drxoutput=''.($dNum/1000000).'.'.$drxoutput.substr($dLen-7,$dLen);
}
echo"$drxoutput";