function capitalize( $str, $each=TRUE ) {
$str = strtolower($str);
if ($each === TRUE) {
$str = ucwords ($str);
} else {
$str = strtoupper($str);
}
echo ("$str
");
}
capitalize("hEllo WoRld!");
capitalize("hEllo WoRld!",FALSE);
?>