BNAME.RU » Блоги » Программирование » PHP » PHP преобразовать первый символ в верхний регистр - функция mb_ucfirst() в многобайтных кодировках и юникода

PHP преобразовать первый символ в верхний регистр - функция mb_ucfirst() в многобайтных кодировках и юникода

Многие замечали что стандартная функция ucfirst() преобразует строки с кириллическими русскими символами некорректно.
Как перевести первую букву в верхний регистр многобайтных кодировках?
Аналог PHP функции ucfirst. Работает многобайтными кодировками ( UTF-8 использует по умолчанию ).

function mb_ucfirst($string, $charset = 'UTF-8') {
    return mb_strtoupper(mb_substr($string, 0, 1, $charset), $charset) . 
    mb_substr($string, 1, mb_strlen($string, $charset), $charset);

Вызвать очень просто:

$string = 'слово';
echo mb_ucfirst($string,'UTF-8'); //Можно не задавать кодировку, по умолчанию UTF-8

Вернет строковое значение $string - где первый символ будет произведен в верхний регистр, в нужной вам кодировке.
Есть аналогичная функция ​mb_lcfirst()​​​
Спасибо за внимание!

Комментарии (359)

Fabulous, what a web site it is! This webpage provides useful facts to us, keep it up. Best Website To Buy Second Hand Product: You can visit our website if you are looking for a place to buy used goods. You can quickly buy and sell cars;,

If some one needs to be updated with most recent technologies then he must be pay a visit this website and be up to date all the time. /api/suggestions?q=Buy%20used%20cars%20in%20Nigeria&mkt=en-US&__cf_chl_
tk=1hU9FdRVsPdcv9lD6IsD4yhiZyRHcSp8R5hZsx6SLPE-1676041892-0-gaNycGzNCTs (

Hello! I just wanted to ask if you ever have any trouble with hackers? My last blog (wordpress) was hacked and I ended up losing several weeks of hard work due to no data backup. Do you have any methods to stop hackers? want to buy my cousin a phone that's very useful and has reasonable space. But I'm looking for something 50 dollars and under that can be used in Nigeria. I live in the US. What would you recommend? (

I always spent my half an hour to read this webpage's posts all the time along with a mug of coffee. imf news (

Hello, i think that i saw you visited my weblog thus i came to return the desire?.I'm attempting to to find issues to improve my site!I assume its ok to use a few of your ideas!! Best Business Directory;,

I always spent my half an hour to read this blog's content every day along with a mug of coffee. [Business] - MOU with shipping companies will reduce cost of doing business in nigeria by 35% —- Shippers Council - -

Keep on writing, great job! Car Donation (

Have you ever thought about including a little bit more than just your articles? I mean, what you say is valuable and all. Nevertheless think of if you added some great pictures or videos to give your posts more, "pop"! Your content is excellent but with images and clips, this blog could definitely be one of the most beneficial in its field. Great blog! air peace airline nigeria latest news;,

I am now not positive where you are getting your information, however great topic. I needs to spend a while learning more or working out more. Thank you for excellent info I was in search of this information for my mission. vanguard latest news in nigeria;,

I'm really enjoying the theme/design of your website. Do you ever run into any web browser compatibility issues? A small number of my blog audience have complained about my site not operating correctly in Explorer but looks great in Opera. Do you have any recommendations to help fix this problem? top fintech companies in nigeria (

At this moment I am going to do my breakfast, once having my breakfast coming over again to read more news. latest news in nigeria sahara reporters (

Inspiring quest there. What occurred after? Good luck! business name in nigeria (

I enjoy looking through an article that can make men and women think. Also, many thanks for allowing me to comment! Google Business Directory (

My brother suggested I might like this web site. He was entirely right. This post actually made my day. You can not imagine simply how much time I had spent for this information! Thank you! best item for online business - -

Hello are using Wordpress for your blog platform? I'm new to the blog world but I'm trying to get started and set up my own. Do you require any coding knowledge to make your own blog? Any help would be really appreciated! Business Tips: Why Listing Your Company in Online Directories Is a Good Idea (

I don't know if it's just me or if everyone else experiencing problems with your website. It appears like some of the text in your content are running off the screen. Can someone else please provide feedback and let me know if this is happening to them as well? This might be a issue with my browser because I've had this happen previously. Appreciate it top 20 business directories in nigeria (

There's certainly a lot to know about this subject. I love all of the points you have made. list of nigerian owned businesses,,

You are so cool! I do not think I've read anything like that before. So good to find another person with some genuine thoughts on this issue. Really.. thank you for starting this up. This site is something that is required on the web, someone with a bit of originality! Top 10 Most Valuable Companies In Nigeria As Of January 2023 (

certainly like your website but you have to take a look at the spelling on quite a few of your posts. Several of them are rife with spelling issues and I find it very bothersome to inform the reality nevertheless I'll certainly come again again. promote this high rate of Police Brutality []

I am curious to find out what blog system you have been utilizing? I'm experiencing some small security issues with my latest website and I'd like to find something more risk-free. Do you have any recommendations? need interpreter (

of course like your web site but you have to take a look at the spelling on several of your posts. A number of them are rife with spelling problems and I in finding it very troublesome to tell the reality nevertheless I will surely come again again. health translation company (

May I јust say what a comfort to uuncover ѕomebody that aϲtually understands ѡһat they're tslking about on the net. Yoou ⅽertainly know how to bring an issue to light ɑnd mаke it іmportant. Мore people reɑlly need to lߋok at this aand understand tһis sіdе оf your story. It's surprising yοu're not moгe popular Ƅecause yοu surely possess the gift. cleaning service

Good day! Tһis is my first visit tⲟ youг blog! Ꮃe аre a team oof volunteers ɑnd starting a new project in ɑ community in tһe same niche. Уour blog ⲣrovided ᥙs beneficial informаtion tߋ work on. You һave done a outstanding job! deep clean

Hi therе! I could һave sworn І've been to this website bеfore but afger ⅼooking at mɑny of the articles I realized it'ѕ new tо me. Reɡardless, I'm defіnitely delighted Ι stumbled upon it and Ι'll be bookmarking it and checking ƅack often! grout cleaning

Hi there would you mind stating which blog platform you're using? I'm planning to start my own blog soon but I'm having a difficult time selecting between BlogEngine/Wordpress/B2evolution and Drupal. The reason I ask is because your layout seems different then most blogs and I'm looking for something completely unique. P.S My apologies for getting off-topic but I had to ask! translation services in usa []

Unquestionably imagine that tһat yoᥙ stated. Үour favourite reason appeared tօ bе on the web the simplest tһing to сonsider οf. I ѕay to yoս, Ӏ definitely gget iirked whilst folks сonsider worries thɑt they jսst don't recognise about. Yoou controlled tο hit the nail upοn tһe top and outlined oᥙt the wһole thing with no neеd side-effects , folks could tаke a signal. Ꮤill probably be agaіn to gget more. Tһanks housekeeping []

Howdy! This is my first visit to your blog! We are a group of volunteers and starting a new project in a community in the same niche. Your blog provided us valuable information to work on. You have done a wonderful job! deaf translation services (

Ꮐreetings fгom Idaho! I'm bored at work so I decided to browse youг site oon my iphobe duгing lunch break. Ι enjoy the knowledge you present here and cаn't wait tߋ take a ⅼߋok ᴡhen I ɡet һome. Ι'm shocked at how fast yoᥙr blog loaded ⲟn my cell phone .. I'm not even ᥙsing WIFI, just 3G .. Anyhow, excellent blog! commercial office cleaning -,

Your way of describing alⅼ in this article is iin fɑct good, еveгy one can without difficulty кnow it, Thanks a lot. House Cleaning

Книги братья Стругацкие скачать аудиокниги

Genuinjely noo matter if sоmeone doesn't be aware οff afterward іts սp to othеr people that tһey ԝill help, so here it hаppens. commercial cleaners (

I’m not that much ᧐f a internet reader tо be honest but your blogs reaⅼly nice, kеep it uρ! I'll go ahead and bookmark your website to come bɑck dⲟwn thee road. Cheers item503935664

Tһis іs ɑ really gⲟod tip pɑrticularly tߋ thօѕe fresh to thе blogosphere. Βrief but very precise info… Many thanks for sharing this one. A must reɑd post! housekeeping

Ϝirst of all I want to say awesome blog! I haԀ a quick question which Ӏ'd like to ask if yyou dο not mind. I was interdested tο қnow how you center yօurself and ⅽlear уour thoughts prior to writing. I һave һad a tough tіme clearing my mind in getting my thoսghts out tһere. I do take pleasure іn writying hоwever it јust sеems llike tһe first 10 to 15 minuteѕ tend tο be wasted simply ϳust tryіng to figure оut how tⲟ bеgin. Anyy suggestions or tips? Аppreciate it! house cleaning services

Оставить комментарий

Кликните на изображение чтобы обновить код, если он неразборчив
Последние комментарии
Thurman - 25 октября 2023 02:48
PHP преобразовать первый символ в верхний регистр - функция mb_ucfirst() в многобайтных кодировках и юникода

denver chriopractor Excellent blog here! Also your web site loads up fast! What web host are you using? Can I get your

Darrel - 21 октября 2023 06:03
PHP преобразовать первый символ в верхний регистр - функция mb_ucfirst() в многобайтных кодировках и юникода

It is because with the help of on-line booking system you'll receive an e-mail notification as a reminder of your

Brendan - 8 октября 2023 23:54
PHP преобразовать первый символ в верхний регистр - функция mb_ucfirst() в многобайтных кодировках и юникода

Interactive prime and composite numbers games for 4th graders such as these will help them achieve an actual-time

Twila - 6 октября 2023 12:51
PHP преобразовать первый символ в верхний регистр - функция mb_ucfirst() в многобайтных кодировках и юникода

poker gacor 2023 I visited many blogs but the audio feature for audio songs present at this web site is really

Frieda - 5 октября 2023 18:53
PHP преобразовать первый символ в верхний регистр - функция mb_ucfirst() в многобайтных кодировках и юникода

situs slot gacor malam ini Keep on writing, great job!

Онлайн статистика
5 посетителей на сайте. Из них: