Splitting a string on multiple separators in PHP

前端 未结 6 515
走了就别回头了
走了就别回头了 2021-01-25 03:50

I can split a string with a comma using preg_split, like

$words = preg_split(\'/[,]/\', $string);

How can I use a dot, a space and

6条回答
  •  囚心锁ツ
    2021-01-25 04:56

    The examples are there, not literally perhaps, but a split with multiple options for delimiter

    $words = preg_split('/[ ;.,]/', $string);
    

提交回复
热议问题