tags:

views:

61

answers:

2

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...

+4  A: 

You can try foreach:

foreach ($search->results as $result) { echo $result->text; }
The MYYN
Perfect just waht I needed.
danit
A: 

This code can help you:

$n=0;
while ($text = $search->results[$n]){
   echo "[$text->text]<br>";
   $n++;
}
amir beygi
I guess he asks for a **foreach** loop example.
JCasso
this is an infinite loop: you never advance to the next item of the array …
knittl
tanx, edited ...
amir beygi