$sourcestring=$html;
preg_match_all('/<font color=\"#FFFFFF\"><b>(.*?)<\/b>/',$sourcestring,$match);
//echo "<pre>".print_r($match,true);
echo($match[0][0]);
我想知道如何使用$match
循环或for
循环将while
变量循环32次?我知道如何打印元素的唯一方法是手动输入:
echo $match([0][1]); .. /// echo $match([0][1]);
有人可以向我解释我如何迭代数组preg_match_all
正在制作吗?
答案 0 :(得分:2)
<?php
$sourcestring="A string1 A string2 A string3 Of string4 to match";
preg_match_all('/string.{1}/',$sourcestring,$match);
$myMatches = "";
foreach($match[0] as $thisMatch){
echo "$thisMatch\n";
$myMatches .= "$thisMatch <br\>";
}
echo $myMatches;