How to split a string with php

前端 未结 4 1669
野的像风
野的像风 2021-01-17 20:03

is there any nice way to split an string after \" \" or . ?

Like

$string = \"test.test\" result = test

$string = \"test doe\" result = test
<         


        
4条回答
  •  轮回少年
    2021-01-17 20:29

    If you want to split on several different chars, take a look at preg_split

    //split string on space or period:
    $split=preg_split('/[ \.]/', $string);
    

提交回复
热议问题