在PHP中,如何同时按空格,逗号和换行符拆分字符串

Mic*_*udt 8 php arrays split explode delimiter

可能重复:
如何在PHP中用多个分隔符拆分字符串?

将字符串同时拆分为三个分隔符的最有效方法是什么,特别是单个空格,换行符和逗号?

dee*_*our 15

既然你已经标记了你的问题,php我会坚持这一点.看到preg_split

$split_strings = preg_split('/[\ \n\,]+/', $your_string);
Run Code Online (Sandbox Code Playgroud)

这将使数组保持干净,如果你的字符串是这样的some, ,,string,它仍将导致['some', 'string']而不是['some', '', '', '', 'string'].