<?php function first_letter($str) { $arr2 = array_filter(array_map('trim',explode(' ', $str))); $result=''; foreach($arr2 as $v) { $result.=$v[0]; } return $result; } $str=" Let's try with more spaces for fun . "; echo first_letter($str); ?>
You have javascript disabled. You will not be able to edit any code.