STring replace

Discussion in 'PHP' started by sridhar_5678, May 14, 2007.

  1. #1
    HI all,

    i have query..

    i want a coding to replace last word "," into "." in text

    eg.$text='1,2,3,';

    i want to replace last comma after 3 to "."

    can any one help me :)

    Regads

    Sridhar
     
    sridhar_5678, May 14, 2007 IP
  2. phper

    phper Active Member

    Messages:
    247
    Likes Received:
    17
    Best Answers:
    0
    Trophy Points:
    60
    #2
    $text[strlen($text)-1] = ".";
     
    phper, May 14, 2007 IP
  3. sridhar_5678

    sridhar_5678 Peon

    Messages:
    2
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Thanks a lot


    Sridhar:D
     
    sridhar_5678, May 15, 2007 IP
  4. coderbari

    coderbari Well-Known Member

    Messages:
    3,168
    Likes Received:
    193
    Best Answers:
    0
    Trophy Points:
    135
    #4
    its a good solution and an easy one.
     
    coderbari, May 15, 2007 IP