时间:2021-07-01 10:21:17 帮助过:21人阅读
$array = array("CREATE TABLE `order_log_1` (`_id` int(11) NOT NULL AUTO_INCREMENT,,`order_info` text,`insert_time` int(11) DEFAULT NULL,PRIMARY KEY (`_id`))",
"CREATE TABLE `order_log_2` (`_id` int(11) NOT NULL AUTO_INCREMENT,,`order_info` text,`insert_time` int(11) DEFAULT NULL,PRIMARY KEY (`_id`))",
"CREATE TABLE `order_log_3` (`_id` int(11) NOT NULL AUTO_INCREMENT,,`order_info` text,`insert_time` int(11) DEFAULT NULL,PRIMARY KEY (`_id`))",
);
$pattern = '/CREATE TABLE `(\w+)`/i';
foreach ($array as $item) {
if (preg_match($pattern, $item, $match)) {
var_dump($match[1]);
}
}
?>