public function each(\Closure $closure)
    {
        $data = [];
        foreach ($this->nodes as $i => $node) {
            $data[] = $closure($this->createSubCrawler($node), $i);
        }

        return $data;
    }
public function each(\Closure $closure)
    {
        $data = [];
        foreach ($this->nodes as $i => $node) {
            $data[] = $closure($this->createSubCrawler($node), $i);
        }

        return $data;
    }
public function each ( \ Closure $ closure ) { $ data = [ ] ; foreach ( $ this -> nodes as $ i => $ node ) { $ data [ ] = $ closure ( $ this -> createSubCrawler ( $ node ) , $ i ) ; } return $ data ; }
Calls an anonymous function on each node of the list.

The anonymous function receives the position and the node wrapped
in a Crawler instance as arguments.

Example:

$crawler->filter('h1')->each(function ($node, $i) {
return $node->text();
});

@param \Closure $closure An anonymous function

@return array An array of values returned by the anonymous function
Calls an anonymous function on each node of the list .