More code critique! (You should fee special)
1) your check to see if $input has data is flawed; if the user enters a long string of whitespace, e.g., holds down the spacebar, your test will fail and you'll try to process $input = ' ' x 1_000. Better to use a regex.
2)Your code will not properly handle a case where somebody enters "Harry S Truman".
There have been several similar threads before; check Super Search. Also, take a look at the rather relevant discussion at Changing from full name to last, first mid.
emc
At that time [1909] the chief engineer was almost always the chief test pilot as well. That had the fortunate result of eliminating poor engineering early in aviation.
—Igor Sikorsky, reported in AOPA Pilot magazine February 2003.In reply to Re: Problem in printing lastname and firstname
by swampyankee
in thread Problem in printing lastname and firstname
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |