Last active
August 29, 2015 14:08
-
-
Save andrearufo/8bb768ddbe49dbc7cec7 to your computer and use it in GitHub Desktop.
Acronym function in PHP
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// return the acronym of a name | |
function acronym($f){ | |
$words = explode(" ", $f); | |
$acronym = ""; | |
foreach ($words as $w){ | |
$acronym .= $w[0]; | |
} | |
return $acronym; | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment