How can I strip some text of all but the first letter?
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]
zollet posted this at 21:32 — 18th September 2002.
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
necrotic posted this at 22:07 — 18th September 2002.
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.