original_string: public static function strtotitle($text) {
          if (empty($text)) {
              return $text;
          }
  
          if (function_exists('mb_convert_case')) {
              return mb_convert_case($text, MB_CASE_TITLE, 'UTF-8');
          }
  
          $text = self::strtolower($text);
          $words = explode(' ', $text);
          foreach ($words as $i=>$word) {
              $length = self::strlen($word);
              if (!$length) {
                  continue;
  
              } else if ($length == 1) {
                  $words[$i] = self::strtoupper($word);
  
              } else {
                  $letter = self::substr($word, 0, 1);
                  $letter = self::strtoupper($letter);
                  $rest   = self::substr($word, 1);
                  $words[$i] = $letter.$rest;
              }
          }
          return implode(' ', $words);
      }
code: public static function strtotitle($text) {
          if (empty($text)) {
              return $text;
          }
  
          if (function_exists('mb_convert_case')) {
              return mb_convert_case($text, MB_CASE_TITLE, 'UTF-8');
          }
  
          $text = self::strtolower($text);
          $words = explode(' ', $text);
          foreach ($words as $i=>$word) {
              $length = self::strlen($word);
              if (!$length) {
                  continue;
  
              } else if ($length == 1) {
                  $words[$i] = self::strtoupper($word);
  
              } else {
                  $letter = self::substr($word, 0, 1);
                  $letter = self::strtoupper($letter);
                  $rest   = self::substr($word, 1);
                  $words[$i] = $letter.$rest;
              }
          }
          return implode(' ', $words);
      }
code_tokens: public static function strtotitle ( $ text ) { if ( empty ( $ text ) ) { return $ text ; } if ( function_exists ( 'mb_convert_case' ) ) { return mb_convert_case ( $ text , MB_CASE_TITLE , 'UTF-8' ) ; } $ text = self :: strtolower ( $ text ) ; $ words = explode ( ' ' , $ text ) ; foreach ( $ words as $ i => $ word ) { $ length = self :: strlen ( $ word ) ; if ( ! $ length ) { continue ; } else if ( $ length == 1 ) { $ words [ $ i ] = self :: strtoupper ( $ word ) ; } else { $ letter = self :: substr ( $ word , 0 , 1 ) ; $ letter = self :: strtoupper ( $ letter ) ; $ rest = self :: substr ( $ word , 1 ) ; $ words [ $ i ] = $ letter . $ rest ; } } return implode ( ' ' , $ words ) ; }
docstring: Makes first letter of each word capital - words must be separated by spaces.
  Use with care, this function does not work properly in many locales!!!
  
  @param string $text input string
  @return string
docstring_tokens: Makes first letter of each word capital - words must be separated by spaces . Use with care this function does not work properly in many locales!!!