我有一个如下字符串:
$str = "`col1` int(4) NOT NULL,`column2` varchar(45),`someothercol` text,";
我想要列名列表,即
之间存在的任何内容 `**`
数组应该包含
array("col1","column2","someothercol");
答案 0 :(得分:1)
$str = "`col1` int(4) NOT NULL,`column2` varchar(45),`someothercol` text,";
$arr = preg_match_all('/`(\w+)`/', $str, $matches);
print_r($matches[1]);
<强>输出:强>
Array
(
[0] => col1
[1] => column2
[2] => someothercol
)