Creating a capitalize function with a default parameter $each
<?php function capitalize( $str, $each=TRUE ) { $str = strtolower($str); if ($each === TRUE) { $str = ucwords ($str); } else { $str = strtoupper($str); } echo ("$str <br />"); } capitalize("hEllo WoRld!"); capitalize("hEllo WoRld!",FALSE); ?>