Jump to content

number_format in custom function


master82

Recommended Posts

Hello All,

I'm trying to create the function named fm [[i]money formatter[/i]] to, err well, format my money!

Hers is what I have:

[code]
<?php

function mf($money)
{
$symb = '£';
number_format($money);
echo"$symb$money";
}

//TO TEST BELOW//
Print"Testing: ";
mf(1000);

?>
[/code]

Seems very simple, it SHOULD have formatted the number (ie 10000 = 10,000) and added a currency symbol before it.

However, the number_format part doesnt seem to work as I get results such as £10000 when I test, and not the £10,000 I was hoping for.

Anyone know what I did wrong or another way to do this?

Thanks in advance!
Link to comment
https://forums.phpfreaks.com/topic/18576-number_format-in-custom-function/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.