The second one is much easier than the first, because PHP has a built-in function for the the second, but not the first.
for returnInitial($var) I suggest using "explode" to break apart the string into several strings using space as a delimiter. Then you can loop through each and take its first...