PHP string money_format() Function

PHP money_format() function is predefined function. It is used formats number as a currency string. It returns a formatted version of number. It wraps the C library function strfmon() and often used with the setlocale() function.

Note: This function does not work on windows platforms.

Syntax:

ParameterDescriptionRequired/Optional
stringSpecify the string to be formatted .Required
numberThe number to be inserted at '%' sign.Required

Example 1

Output:

Your number is:1234.56
By using money_format() function:1.234,56 EUR

Example 2

Output:

Your number is:-1234.5672
By using money_format() function:(******1234.57)

Example 3

Output:

Your number is:-1234.5672
By using money_format() function:-USD 1,234.57

Example 4

Output:

Your number is:-1234.5672
By using money_format() function:-EUR 1.234,57

Next TopicPHP String




Latest Courses