首页 > Other > php lcfirst 5.2兼容函数

php lcfirst 5.2兼容函数

lcfirst(首字母小写) 函数在5.3版本中已经提供,但5.2版本中没有。以下始终兼容写法:

if(!function_exists(‘lcfirst’)){
function lcfirst($str){
$cstr = ord($str[0]);
if($cstr > 64 && $cstr < 90){
$str[0] = chr($cstr+32);
}
return $str;
}
}

分类:Other
  1. 还没有评论。
  1. No trackbacks yet.

发表评论

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / 更改 )

Twitter picture

You are commenting using your Twitter account. Log Out / 更改 )

Facebook photo

You are commenting using your Facebook account. Log Out / 更改 )

Google+ photo

You are commenting using your Google+ account. Log Out / 更改 )

Connecting to %s

%d 博主赞过: