PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
I'm looking for a way to turn long names (eg; Brandon Bergenroth) into much shorter names by removing the first name and converting it into just an initial - so my example would now be 'B Bergenroth'.
I've managed to chop the name up into two variables using the explode function but I'm not sure how I turn 'Brandon' into just 'B'.
Here's what I have so far, does anyone have the second step?
DSM wrote:NP...
had the same thing come up today, creating directories with user first intial and lastname as the name of the dir
What happens if 2 or more people have the same name?
Before you create you check if there is already dir with that name, if there is, put a number after the lastname. (eg. ajhonson and ajhonson1 etc...) Remember to check also if there are already same name with a number.... or you could also use in a case like this a few special characters that are allowed in directory names like ajhonson and a_jhonson.