Use PHP for splitting on spaces and brackets

后端 未结 5 854
醉梦人生
醉梦人生 2021-01-21 09:03

I have this string in $s:

ben say (#yellow) hey

At the moment I\'m using:

$parts = array_filter(preg_sp         


        
5条回答
  •  轻奢々
    轻奢々 (楼主)
    2021-01-21 09:30

    this will work:

    $parts = array_filter(preg_split('/[\s\(\)]+/', $s));
    

提交回复
热议问题