hai friends,

i am working in windows.
<?php
$number = 1234.56;
setlocale(LC_MONETARY, 'en_US');
echo money_format('%i', $number) . "\n";
?>

The function money_format() is only defined if the system has strfmon capabilities. For example, Windows does not, so money_format() is undefined in Windows.

so what to do to display in money format, is any other function there or have to change some system settings ? help me friends.........🙂

thanks in Advance
j.sivaani

    hai thanks for quick reply thank u once again

    the output of the number_format() is for example: 300,300,366 but i want like this 30,03,00,366 . thats why i am trying some other way

    Thanks in advance ,
    j.sivaani

      J.Sivaani wrote:

      the output of the number_format() is for example: 300,300,366 but i want like this 30,03,00,366 . thats why i am trying some other way

      Ummm...why would you want it output like that? I am not aware of any money format that looks like that, and therefore doubt there is any built-in PHP function for it. You will probably have to create your own function, using various string functions to get the length of the numeric string and insert commas where desired.

        hai friends ,
        i used some simple php functions, i got the answer

        <!--Indian money value-->

        <?php
        $number="7001322311";
        $spl=str_split($number);
        $lpcount=count($spl);
        $rem=$lpcount-3;
        //echo "rem".$rem."<br/>";
        //even one
        if($lpcount%2==0)
        {
        for($i=0;$i<=$lpcount-1;$i++)
        {

        if($i%2!=0 && $i!=0 && $i!=$lpcount-1)
        {
        	echo ",";
        }

        echo $spl[$i];
        }
        }
        //odd one
        if($lpcount%2!=0)
        {
        for($i=0;$i<=$lpcount-1;$i++)
        {

        if($i%2==0 && $i!=0 && $i!=$lpcount-1)
        {
        	echo ",";
        }

        echo $spl[$i];
        }
        }

        ?>

        Thanks for replies
        j.sivaani

          7 months later

          Your job is really good.

          J.Sivaani;10850932 wrote:

          hai friends ,
          i used some simple php functions, i got the answer

          <!--Indian money value-->

          <?php
          $number="7001322311";
          $spl=str_split($number);
          $lpcount=count($spl);
          $rem=$lpcount-3;
          //echo "rem".$rem."<br/>";
          //even one
          if($lpcount%2==0)
          {
          for($i=0;$i<=$lpcount-1;$i++)
          {

          if($i%2!=0 && $i!=0 && $i!=$lpcount-1)
          {
          	echo ",";
          }

          echo $spl[$i];
          }
          }
          //odd one
          if($lpcount%2!=0)
          {
          for($i=0;$i<=$lpcount-1;$i++)
          {

          if($i%2==0 && $i!=0 && $i!=$lpcount-1)
          {
          	echo ",";
          }

          echo $spl[$i];
          }
          }

          ?>

          Thanks for replies
          j.sivaani

            Write a Reply...