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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.