$output = preg_replace('/([.!?])s*(w)/e', "strtoupper('\1 \2')", ucfirst(strtolower($input)));由于PHP 5.5.0中不推荐使用修饰符 e :
$output = preg_replace_callback('/([.!?])s*(w)/', function ($matches) { return strtoupper($matches[1] . ' ' . $matches[2]);}, ucfirst(strtolower($input)));


