How to split a string with php

前端 未结 4 1636
野的像风
野的像风 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:37

    You want the strtok function. The manual gives this example:

    ";
        $tok = strtok(" \n\t");
    }
    ?>
    

    Though in your case I suspect that using explode twice is easier and looks better.

提交回复
热议问题