Return to Snippet

Revision: 30890
at August 24, 2010 23:27 by iloveitaly


Initial Code
function ucname($string) {
	$string = ucwords(strtolower($string));

	foreach(array('-', '\'') as $delimiter) {
		if (strpos($string, $delimiter) !== false) {
			$string = implode($delimiter, array_map('ucfirst', explode($delimiter, $string)));
		}
	}
	
	return $string;
}

Initial URL
http://php.net/manual/en/function.ucwords.php

Initial Description
Grabbed it from the comments for ucfirst

Initial Title
ucname / Title Case

Initial Tags


Initial Language
PHP