开发者

Getting values with preg_match_all

How can I get each value returned by PHP preg_match_all using for each loop, because I want to insert each value in database.开发者_开发百科 Thanks


preg_match_all('/pattern/', $haystack, $matches);
foreach($matches[0] as $match) {
    echo $match;
}

The third parameter is the variable where the matches will be stored. You can use print_r($matches) to see the structure of the array and design your code accordingly

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜