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
精彩评论