PHP Maths Clean Number

Discussion in 'PHP' started by redslazers, Apr 6, 2011.

  1. #1
    If i do

    $orig = pow(2,1000);
    
    echo ($orig);
    Code (markup):
    then it gives me that answer as 1.0715086071863E+301

    what do i have to do to get it as a clean number (eg. 34995497348909) ?

    thanks or any help
     
    redslazers, Apr 6, 2011 IP
  2. Alex Roxon

    Alex Roxon Active Member

    Messages:
    424
    Likes Received:
    11
    Best Answers:
    7
    Trophy Points:
    80
    #2
    For display purposes? Convert it to a string.
     
    Alex Roxon, Apr 6, 2011 IP
  3. redslazers

    redslazers Peon

    Messages:
    242
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #3
    so i can str_split it and add the individual digits

    im not really sure what you mean by convert to string
     
    redslazers, Apr 6, 2011 IP
  4. redslazers

    redslazers Peon

    Messages:
    242
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #4
    problem solved, the idea you gave me lead to number_format which works if you remove the decimals
     
    redslazers, Apr 6, 2011 IP