Posted By

iloveitaly on 07/11/09


Tagged

database method function title variable kohana inflector titlize


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

tux-world


Convert Database/Variable Name to Human Title


 / Published in: PHP
 

  1. <?
  2. class inflector extends inflector_Core {
  3. public static function titlize($rawTitle) {
  4. if(strlen($rawTitle) < 3) {
  5. return strtoupper($rawTitle);
  6. } else {
  7. return ucwords(self::humanize($rawTitle));
  8. }
  9. }
  10. }
  11.  
  12. echo inflector::titlize("news_items"); // News Items
  13. echo inflector::titlize("id"); // ID
  14. ?>

Report this snippet  

You need to login to post a comment.