Getting someones initials from a string of their name in PHP
Posted on 2004-11-08
I have a string of a name eg "Benjamin James Smith".
I need to get the initials of that name into another string eg "BJS".
At present I am having to split the string by spaces and substr each element of the array. I'm sure their must be a simple way with ereg_replace but I dont have a good enough understanding of the characters you put into that function to make it do what you want!
Can someone tell me how to perform the above function and also point me in the right direction for documentation of how that function works.