Search code examples
phpormiteratorkohana

kohana next iterator


I am using the next() iterator in order to get the second element from a colection, but this next() returns me an oject like: Resource id #115 . the code:

   $first_two = $product->images->limit(2)->find_all();
   $second = next($first_two);

and next($first_two); gives: Resource id #115 for example.

How can i make it show just 115 (only the id?)

i need it for making a query after this id.

Thank you!


Solution

  • Try $second->id? If you're using ORM, which I think you are, then find_all() returns Database_result trough which you can iterate.