CamelCase in PHP

Example for versions PHP 5.3.2

This example uses string functions and regular expressions. Function ucwords converts first letter of each word to uppercase.

<?
$text = fgets(STDIN);
$text = str_replace(' ', '', ucwords(preg_replace('/[^a-z]/', ' ', strtolower($text))));
echo $text;
?>