Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

php get first character of each word

if(!function_exists('get_avatar')){
    function get_avatar($str){
        $acronym;
        $word;
        $words = preg_split("/(s|-|.)/", $str);
        foreach($words as $w) {
            $acronym .= substr($w,0,1);
        }
        $word = $word . $acronym ;
        return $word;
    }
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #php #character #word
ADD COMMENT
Topic
Name
9+8 =