get first letter of each word
explode()
on the spaces, then you use the []
notation to access the resultant strings as arrays:
$string = "Community College District";$result = "CCD";
$words = explode(" ", "Community College District");$acronym = "";foreach ($words as $w) { $acronym .= $w[0];}