php preg_split按新行爆炸

时间:2014-03-16 07:30:21

标签: php mysql

<?php
$string = '   
1

2

3

4';

$tags = preg_split('/[;:, \rn]+/', $string); 
foreach ($tags as $to_x)
{
  echo strlen($to_x)."</br>";
}
?>

输出错误

按新行爆炸但不显示正确的strlen。

输出

1

2

2

2

实际应该是

1

1

1

1

我哪里错了???

1 个答案:

答案 0 :(得分:0)

'/ [;:,\ r \ n] + /'

确保它是\ n

相关问题