我越来越不推荐使用 PHP:函数 create_function()
使用以下代码:
function fetch_sentence_case($text)
{
return preg_replace_callback(
'#(^|\.\s+|\:\s+|\!\s+|\?\s+)[a-z]#',
create_function('$matches', 'return strtoupper($matches[0]);'),
vbstrtolower($text)
);
}
我试过了
function fetch_sentence_case($text)
{
return preg_replace_callback(
'#(^|\.\s+|\:\s+|\!\s+|\?\s+)[a-z]#',
function($matches) { return strtoupper($matches[0]; },
vbstrtolower($text)
);
}
但它不起作用。
???