Simple foreach loop
I have this code:
$summize = new summize;
$search = $summize->search(开发者_如何学运维'#test');
$text = $search->results[0]->text;
$text
stores the result, but only the first result of the array.
How ca a write a loop to go through all the values and output through say echo...
You can try foreach
:
foreach ($search->results as $result) { echo $result->text; }
This code can help you:
$n=0;
while ($text = $search->results[$n]){
echo "[$text->text]<br>";
$n++;
}
精彩评论