How can I strip some text of all but the first letter?

He has: 296 posts

Joined: May 2002

I'm making a PHP program that has categories #-Z and I need to strip an input of all but the first letter. I have no idea how to do this. Say someone was to input "My First Song" I want all but the "M" to be stripped. Can anyone tell me how this can be done?

[James Logsdon]

He has: 1,016 posts

Joined: May 2002

<?php
$first_letter
= substr($string, 0, 1);
?>

Here is all the information you can ever need about substr().. Read it and try to understand how it work. http://www.php.net/substr

He has: 296 posts

Joined: May 2002

Awesome! Thanks alot.

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.