create initials


SUBMITTED BY: phpsnippets

DATE: Oct. 21, 2015, 2:04 p.m.

FORMAT: Text only

SIZE: 216 Bytes

HITS: 1611

  1. <?php
  2. function initials($name){
  3. $nword = explode(" ",$name);
  4. foreach($nword as $letter){
  5. $new_name .= $letter{0}.'.';
  6. }
  7. return strtoupper($new_name);
  8. }
  9. echo initials('John Doe');
  10. ?>

comments powered by Disqus