ucname / Title Case


/ Published in: PHP
Save to your folder(s)

Grabbed it from the comments for ucfirst


Copy this code and paste it in your HTML
  1. function ucname($string) {
  2. $string = ucwords(strtolower($string));
  3.  
  4. foreach(array('-', '\'') as $delimiter) {
  5. if (strpos($string, $delimiter) !== false) {
  6. $string = implode($delimiter, array_map('ucfirst', explode($delimiter, $string)));
  7. }
  8. }
  9.  
  10. return $string;
  11. }

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

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.