Tüm karakter etkilediği gibi strtolower kullanamazsınız. Ben düzenli ifade çeşit kullanmalı mıyım?
Ben küçük yapılmış ilk harfi ile farklı bir palce bir arama tuşu olarak bu ürün kodunu kullanmak istiyorsanız, bir ürün kodu bir dize alıyorum.
Denemek
ve PHP < 5.3 küresel kapsam içine ekleyin:
if (!function_exists('lcfirst')) {
function lcfirst($str)
{
$str = is_string($str) ? $str : '';
if(mb_strlen($str) > 0) {
$str[0] = mb_strtolower($str[0]);
}
return $str;
}
}
Gereken sadece strolower ing üzerinde yukarıda avantajı PHP5.3 yükseltme kez PHP kodu sadece yerli fonksiyonuna geçmek olacaktır
Updated after comments. The function does now check whether there actually is a first character in the string and that it is an alphabetic character in the current locale. It is also multibyte aware now.
kullanmak icfirst()
<?php
$foo = 'HelloWorld';
$foo = lcfirst($foo); // helloWorld
$bar = 'HELLO WORLD!';
$bar = lcfirst($bar); // hELLO WORLD!
$bar = lcfirst(strtoupper($bar)); // hELLO WORLD!
?>