/ Published in: PHP
HP’s ucfirst function is very usefull when you want to change words first letters to uppercase and other letters to lowercase. Currently on PHP does not have a multibyte (UTF-8) version of ucfirst function. So I decided write my own multibyte mb_ucfirst function.
Perhaps the multibyte version of ucfirst function is added later on PHP, so that’s why is better add this function only if it does not already exist.
Perhaps the multibyte version of ucfirst function is added later on PHP, so that’s why is better add this function only if it does not already exist.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
<?php function mb_ucfirst($str, $encoding = "UTF-8", $lower_str_end = false) { $str_end = ""; if ($lower_str_end) { } else { } $str = $first_letter . $str_end; return $str; } } ?>