parse search string for phrases and keywords

后端 未结 3 2028
滥情空心
滥情空心 2021-02-04 14:41

i need to parse a search string for keywords and phrases in php, for example

string 1: value of \"measured response\" detect goal \"method valuation\" study

3条回答
  •  孤独总比滥情好
    2021-02-04 15:28

    There is no need to use a regular expression, the built in function str_getcsv can be used to explode a string with any given delimiter, enclosure and escape characters.

    Really it is as simple as.

    // where $string is the string to parse
    $array = str_getcsv($string, ' ', '"'); 
    

提交回复
热议问题