1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

can i chabge the first letter of each word to cap

Discussion in 'PHP' started by pizzaman, Feb 1, 2008.

  1. #1
    hi
    i have a lot of data that are not uniformly capitalized
    i want to change these so that the first letter of the word is capitalized

    my example one
    MY EXAMPLE TWO
    My Example three

    should be changed to
    My Example One
    My Example Two
    My Example Three

    can i do this with php ?
     
    pizzaman, Feb 1, 2008 IP
  2. archgames.net

    archgames.net Well-Known Member

    Messages:
    532
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    120
    #2
    yes it can be done and i think you can do it with str_replace but i cant remember how now...
     
    archgames.net, Feb 1, 2008 IP
  3. TwistMyArm

    TwistMyArm Peon

    Messages:
    931
    Likes Received:
    44
    Best Answers:
    0
    Trophy Points:
    0
    #3
    $string = ucwords( strtolower( $string ) );
     
    TwistMyArm, Feb 1, 2008 IP
  4. pizzaman

    pizzaman Active Member

    Messages:
    4,053
    Likes Received:
    52
    Best Answers:
    0
    Trophy Points:
    90
    #4
    thanks dude
     
    pizzaman, Feb 1, 2008 IP
    guerilla and iggysick like this.
  5. zerostar07

    zerostar07 Peon

    Messages:
    34
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    and if you have utf8 characters try a custom implementation http:codeigniter.com/forums/viewthread/67668/
     
    zerostar07, Feb 2, 2008 IP