Php to obtain the first letter of an English name ,. Php obtains the first letter of an English name. This document describes how php obtains the first letter of an English name. Share it with you for your reference. The code is as follows: you can use php to obtain the first letter of an English name,
This example describes how to obtain the first letter of an English name in php. Share it with you for your reference. The details are as follows:
This code analyzes the first letter of a name based on the English name entered by the user, for example, "Billy Bob" to "B. B ."
<? Php function initials ($ name) {$ nword = explode ("", $ name); foreach ($ nword as $ letter) {$ new_name. = $ letter {0 }. '. ';} return strtoupper ($ new_name);} echo initials ('John Doe');?>
I hope this article will help you with php programming.
Example: How php obtains the first letter of an English name. Share it with you for your reference. The code is as follows...