Converting a string to a very long int?! howto?!

Discussion in 'PHP' started by redhits, Mar 1, 2006.

  1. #1
    $i_toate=str_replace(' ','',$i_toate);
    $i_toate=str_replace(',','',$i_toate);
    $i_toate=str_replace('.','',$i_toate);
    and then to
    $i_toate=$i_toate+1-1;


    But is not working! is giving me back a zero value! try this out!


    $i_toate="62,500,102";
    $i_toate=str_replace(' ','',$i_toate);
    $i_toate=str_replace(',','',$i_toate);
    $i_toate=str_replace('.','',$i_toate);
    $i_toate=$i_toate+1-1;
    echo "$i_toate";
    why?!
     
    redhits, Mar 1, 2006 IP
  2. wwm

    wwm Peon

    Messages:
    308
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    0
    #2
    TRY casting it
     
    wwm, Mar 1, 2006 IP
  3. noppid

    noppid gunnin' for the quota

    Messages:
    4,246
    Likes Received:
    232
    Best Answers:
    0
    Trophy Points:
    135
    #3
    You may need to store the value one in a variable and cast it as well.
     
    noppid, Mar 1, 2006 IP
  4. neroux

    neroux Active Member

    Messages:
    566
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    60
    #4
    Which PHP version are you using? For me it works.
     
    neroux, Mar 2, 2006 IP
  5. redhits

    redhits Notable Member

    Messages:
    3,023
    Likes Received:
    277
    Best Answers:
    0
    Trophy Points:
    255
    #5
    Yup sorry i was also grablidng those data with some nasty HTML codes, like <b></b> because of that it didn't worked! thanks anyway ! i love you all !
     
    redhits, Mar 3, 2006 IP