function strProper($str) { $parts = explode(' ', $str); $rez = ''; foreach ($parts as $p) { if (trim($p)) { $rez .= ($rez ? ' ' : '') . themerex_strtoupper(themerex_substr($p, 0, 1)) . themerex_strtolower(themerex_substr($p, 1)); } } return $rez; }
function themerex_strtoproper($text) { $rez = ''; $last = ' '; for ($i = 0; $i < themerex_strlen($text); $i++) { $ch = themerex_substr($text, $i, 1); $rez .= themerex_strpos(' .,:;?!()[]{}+=', $last) !== false ? themerex_strtoupper($ch) : themerex_strtolower($ch); $last = $ch; } return $rez; }