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 Link to comment https://forums.phpfreaks.com/topic/79453-function-for-cutting-up-last-name/ 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']); ?> Link to comment https://forums.phpfreaks.com/topic/79453-function-for-cutting-up-last-name/#findComment-402287 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. Link to comment https://forums.phpfreaks.com/topic/79453-function-for-cutting-up-last-name/#findComment-404033 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.