Variable $name (string) gives something like (possible values):
"Elton John"
"2012"
" George Bush"
" Julia"
"Marry III Great"
Want to catch the first letter of $name and add it to $letter variable.
It's important how many words (divided with spaces " ") the string has:
If there is just one word, set
$letterto the first letter of the first word.If there is more than one word, set
$letterto the first letter of the second word.If
$nameis empty, set$letterto'undefined'.
Thanks.