PHP explode terms in to array, retain quoted text as single array item

前端 未结 4 2006
粉色の甜心
粉色の甜心 2021-01-17 00:11

I have the following string from a form...

Opera \"adds cross-platform hardware\" \"kicks butt\" -hippies

In general I\'ve simpl

4条回答
  •  攒了一身酷
    2021-01-17 00:47

    try this without using regex, a rough code

    ";
    print_r($g);
    echo "
    "; function explodeMe($string){ $k=explode('"',$string); foreach ($k as $key => $link) { if ($k[$key] == ' ') { unset($k[$key]); } } return array_values($k); } ?>

提交回复
热议问题