International en_US format:
The output of the code above will be:
The money_format() function returns a string formatted as a currency string.
This function inserts a formatted number where there is a percent (%) sign in the main string.
Note: The money_format() function does not work on Windows platforms.
Tip: This function is often used together with the setlocale() function.
Tip: To view all available language codes, go to our Language code reference.
| Parameter | Description |
|---|---|
| string | Required. Specifies the string to be formatted and how to format the variables in it. Possible format values: Padding and Flags:
Field width:
Conversion characters:
Note: If multiple format values are used, they must be in the same order as shown above. Note: This function is affected by local settings. |
| number | Required. The number to be inserted at the %-sign in the format string |
| Return Value: | Returns the formatted string. Characters before and after the formatting string will be returned unchanged. Non-numeric number causes returning NULL and emitting E_WARNING |
|---|---|
| PHP Version: | 4+ |
International format (Germany) with 2 decimals:
The output of the code above will be:
Negative number, US national format with () to indicate negative numbers and 2 digits of right precision and "*" as a fill character:
The output of the code above will be:
The perfect solution for professionals who need to balance work, family, and career building.
More than 10 000 certificates already issued!
The HTML Certificate documents your knowledge of HTML.
The HTML5 Certificate documents your knowledge of advanced HTML5.
The CSS Certificate documents your knowledge of advanced CSS.
The JavaScript Certificate documents your knowledge of JavaScript and HTML DOM.
The jQuery Certificate documents your knowledge of jQuery.
The XML Certificate documents your knowledge of XML, XML DOM and XSLT.
The ASP Certificate documents your knowledge of ASP, SQL, and ADO.
The PHP Certificate documents your knowledge of PHP and SQL (MySQL).
Your message has been sent to W3Schools.