Code:
<?php
function custom_ucwords($map, $string) {
$inside_word = TRUE;
for ($index = 0; $index < strlen($string); ++$index) {
$is_chr = isset($map[$string[$index]]);
if (! $inside_word && $is_chr) {
$string[$index] = $map[$string[$index]];
}
$inside_word = $is_chr;
}
return $string;
}
$map = array(
'a' => 'A', 'b' => 'B', 'c' => 'C', 'd' => 'D',
'e' => 'E', 'f' => 'F', 'g' => 'G', 'h' => 'H',
'i' => 'I', 'j' => 'J', 'k' => 'K', 'l' => 'L',
'm' => 'M', 'n' => 'N', 'o' => 'O', 'p' => 'P',
'q' => 'Q', 'r' => 'R', 's' => 'S', 't' => 'T',
'u' => 'U', 'v' => 'V', 'w' => 'W', 'x' => 'X',
'y' => 'Y', 'z' => 'Z'
);
$string = file_get_contents("file.txt");
echo custom_ucwords($map, $string);
?>
save as do.php
put words in a file called file.txt
visit php ina browser