$str = 'answers[0] = "Love it"; answers[1] = "Hate it."; answers[2] = "Doesnt care"; answers[3] = "Like it";'
如何将其转换为数组?
最佳答案
$str = 'answers[0] = "Love it"; answers[1] = "Hate it."; answers[2] = "Doesnt care"; answers[3] = "Like it";';
preg_match_all('/"(.*)";/U', $str, $matches);
$arr = $matches[1];
var_dump($arr);
关于PHP 将字符串数组列表转换为数组,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19025404/