Jump to content

string conversion


rwwd

Recommended Posts

[!--fonto:Verdana--][span style=\"font-family:Verdana\"][!--/fonto--]
Hello there everybody,

Silly thing to ask but say you have a string ie: timothy, and you wanted this to become first letter uppercase ie: Timothy, how would I do this, so that every time you have a string in a variable the first letter displayed would be uppercase every time?

Any help is appreciated

Thanks
Rwwd
[!--fontc--][/span][!--/fontc--]
Link to comment
https://forums.phpfreaks.com/topic/5500-string-conversion/
Share on other sites

There is the function [a href=\"http://www.php.net/ucwords\" target=\"_blank\"]ucwords[/a]() which will make each word in a string start with a capital letter. Is this what you are looking for?

You can also use CSS.

[code]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">

<html>
<head>
    <title></title>
    <style>
.initc {
    text-transform: capitalize;
}    
    </style>
</head>

<body>
<p class="initc">this is a test</p>
<p><?php echo ucwords('this is another test') ?></p>

</body>
</html>
[/code]

Ken
Link to comment
https://forums.phpfreaks.com/topic/5500-string-conversion/#findComment-19668
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.