I am trying to use some Goutte code :
$oldtext='';
// Get the latest post in this category and display the titles
$crawler->filter('h2 > a')->each(function ($node) {
print $node->text()."\n";
$oldtext=$node->text();
print $oldtext."\n";
});
I have 2 questions :
- what does statement "function ($node)" it's kind of inline function definition
- why $oldtext variable it's not presistent ? it's like inside of "function ($node)" all variables are reinitiated