Modifying capitalize( ) to take a reference parameter
<?php function capitalize( &$str, $each=TRUE ){ { $str = strtolower($str); if ($each === true) { $str = ucwords($str); } else { $str{0} = strtoupper($str{0}); } } $str = "hEllo WoRld!"; capitalize( $str ); echo $str; ?>