Ask a Question related to PHP Development, Design and Development.

  1. #1

    Default divide

    Hello,
    I'm new in php and i've got allready a problem.
    I wanna divide 2 numbers and the result to be an integer separated by comma. For example:
    $number1=10000000;
    $number2=17;
    $result=$number1 / $number2;
    In this case the result is 588235.29411764....
    And I wanna the result to be like this 588,235

    thanks

    Phpu Guest

  2. Similar Questions and Discussions

    1. Divide 24h into parts
      Hello, I'm creating a small web application for my company, but I can't find a good and reliable algorithm to create a function which divides...
    2. Divide by Zero in RDE
      On Fri, Oct 10, 2003 at 01:15:13AM +0900, Johan Nilsson wrote: You mentioned a patch for another version. I have once upgraded RDE to a newer...
    3. Gap when using Divide
      Hello, I was trying Freehand MX and noticed that when using the Divide command, appears a small gap between the newly created shapes... Is there a...
    4. Divide by Zero Error
      Receive the folowing error when attempting to add a new "label" to an Access 2000 form (note: form has other controls and labels working correctly...
    5. [VCD] How can U divide into chapters'
      I have a file ready to be burt as a 50mins VCD. But if I create a VCD with this file, then I will end up with one chapter lasting the whole...
  3. #2

    Default Re: [PHP] divide

    yes but if the result is a number like this 34056983 i wanna display this number like this 34,056,983
    Please help me with this one
    ----- Original Message -----
    From: Nathan Taylor
    To: phpu
    Sent: Wednesday, September 10, 2003 2:49 AM
    Subject: Re: [PHP] divide


    Check out number_format();

    www.php.net/number_format
    ----- Original Message -----
    From: phpu
    To: php-general@lists.php.net
    Sent: Tuesday, September 09, 2003 7:50 PM
    Subject: [PHP] divide


    Hello,
    I'm new in php and i've got allready a problem.
    I wanna divide 2 numbers and the result to be an integer separated by comma. For example:
    $number1=10000000;
    $number2=17;
    $result=$number1 / $number2;
    In this case the result is 588235.29411764....
    And I wanna the result to be like this 588,235

    thanks


    Phpu Guest

  4. #3

    Default Re: [PHP] divide

    On Tuesday 09 September 2003 05:04 pm, phpu wrote:
    > yes but if the result is a number like this 34056983 i wanna display this
    > number like this 34,056,983 Please help me with this one

    that's exactly what number_format() does... from the example on
    [url]www.php.net/number_format[/url] :

    <?php

    $number = 1234.56;

    // english notation (default)
    $english_format_number = number_format($number);
    // 1,234

    // French notation
    $nombre_format_francais = number_format($number, 2, ',', ' ');
    // 1 234,56

    $number = 1234.5678;

    // english notation without thousands seperator
    $english_format_number = number_format($number, 2, '.', '');
    // 1234.57

    ?>

    that's all there is to it.
    Gabriel Guzman Guest

  5. #4

    Default Re: [PHP] divide

    Sorry
    I've got it.
    Thanks a lot
    ----- Original Message -----
    From: Nathan Taylor
    To: phpu
    Sent: Wednesday, September 10, 2003 2:59 AM
    Subject: Re: [PHP] divide


    Check out number_format() like I said.
    ----- Original Message -----
    From: phpu
    To: Nathan Taylor
    Cc: php-general@lists.php.net
    Sent: Tuesday, September 09, 2003 8:04 PM
    Subject: Re: [PHP] divide


    yes but if the result is a number like this 34056983 i wanna display this number like this 34,056,983
    Please help me with this one
    ----- Original Message -----
    From: Nathan Taylor
    To: phpu
    Sent: Wednesday, September 10, 2003 2:49 AM
    Subject: Re: [PHP] divide


    Check out number_format();

    www.php.net/number_format
    ----- Original Message -----
    From: phpu
    To: php-general@lists.php.net
    Sent: Tuesday, September 09, 2003 7:50 PM
    Subject: [PHP] divide


    Hello,
    I'm new in php and i've got allready a problem.
    I wanna divide 2 numbers and the result to be an integer separated by comma. For example:
    $number1=10000000;
    $number2=17;
    $result=$number1 / $number2;
    In this case the result is 588235.29411764....
    And I wanna the result to be like this 588,235

    thanks



    Phpu Guest

  6. #5

    Default Re: [PHP] divide

    From: "phpu" <phpu@go.ro>
    > I'm new in php and i've got allready a problem.
    > I wanna divide 2 numbers and the result to be an integer separated by
    comma. For example:
    > $number1=10000000;
    > $number2=17;
    > $result=$number1 / $number2;
    > In this case the result is 588235.29411764....
    > And I wanna the result to be like this 588,235
    I don't know if this is old or not, but I just got it.

    Anyhow, use number_format()

    ---John Holmes...
    Cpt John W. Holmes Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139