求截取PHP指定字符串代码
有下面一段html字符串:
$s = 'aaaa ';
bbbb
cccc
dddd
echo preg_replace('/
\w+/', '', $s, 2);
aaaa
dddd
echo preg_replace('/
[^<]+/', '', $s, 2);
echo preg_replace('/\(.+?\)/', '', $s);
echo preg_replace_callback('/
[^<]+/', 'foo', $s, 2);
function foo($m){
return strpos($m[0], '(') !== false ? preg_replace('/\(.+?\)/','',$m[0]) : '';
}