• PHP Video Tutorials

PHP - Function Money Format



Syntax

string money_format ( string $format , float $number )

Definition and Usage

It is used to formats a number as a currency string

Return Values

It returns the formatted strings or NULL on failure.

Parameters

Sr.No Parameters & Description
1

string

It contains the information about specified string to be formatted.

2

number

The number to be inserted at the %-sign in the format string.

Example

Try out the following example

<?php
   $input = 1000.56;
   setlocale(LC_MONETARY,"de_DE");
   
   echo money_format("%.2n", $input);
?>

This will produce following result −

1.000,56 EUR
php_function_reference.htm
Advertisements