Have you ever wanted an easy way to titleize a string? Here it is.
PHP:
-
/**
-
* Create a title out of string
-
*
-
* @return string
-
* @author Justin Palmer
-
**/
-
public function titleize($string)
-
{
-
'if', 'once', 'than', 'that', 'till', 'when',
-
'at', 'by', 'down', 'from', 'in', 'into', 'like', 'near', 'of',
-
'off', 'on', 'onto', 'over', 'past', 'to', 'upon', 'with', 'a', 'an', 'the');
-
for($i = 0; $i <sizeof($array); $i++){
-
}else{
-
$string .= $array[$i] . ' ';
-
}
-
}
-
}
Let me know what you think.
Development php string« Rails number_with_delimiter for PHP WordPress 2.1.1 to 3.0 »
