Captialising letters.

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
evilcoder
Forum Contributor
Posts: 345
Joined: Tue Dec 17, 2002 5:37 am
Location: Sydney, Australia

Captialising letters.

Post by evilcoder »

Hey guys, this is weird, i used to know how to do this, but i cant remember.

i have http strings like this: /?i8=hello_there

now, that calls the file hello_there.php

however i have a "Where am i:" text bar..

When that address gets called i want the text bar to say: Where am i: Hello There.

I know how to remove the _ and replace it with   with ereg_replace, but how to i;
a: Capitalise the First letter of the variable
b: Capitalise the first letter after the _

Thanks guys
qartis
Forum Contributor
Posts: 271
Joined: Sat Dec 14, 2002 4:43 pm
Location: BC, Canada
Contact:

Post by qartis »

$string = "hello_world";
$string = str_replace("_"," ",$string);
$string = ucwords($string);
evilcoder
Forum Contributor
Posts: 345
Joined: Tue Dec 17, 2002 5:37 am
Location: Sydney, Australia

Post by evilcoder »

thank mate.. works the charm
Post Reply