karatekid36 Posted November 29, 2007 Share Posted November 29, 2007 Howdy everyone, I am pulling the last name from a table and I want the name to display as First L. not First Last. I am not sure how to do this in a function. All I need is the first letter of the last name followed by a period. Can anyone explain this to me? Thank you. karatekid36 Quote Link to comment Share on other sites More sharing options...
The Little Guy Posted November 29, 2007 Share Posted November 29, 2007 <?php function nameShort($name){ list($fN,$lN) = expolde(" ",$name); return $fN.' '.substr($lN,0,1).'.'; } echo nameShort($row['fname'].' '.$row['lname']); ?> Quote Link to comment Share on other sites More sharing options...
karatekid36 Posted December 2, 2007 Author Share Posted December 2, 2007 thank you very much. I now understand how this works. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.