Open Takuaraa opened 6 years ago
If you just need the total count…
$h1 = $crawler->filter('h1')->each(function ($node) {
return $node->text();
});
print count($h1);
If you want to print each increment…
$crawler->filter('h1')->each(function ($node) use ($count) {
Or…
$crawler->filter('h1')->each(function ($node) {
global $count;
Why not:
$crawler->filter('h1')->count();
Why not:
$crawler->filter('h1')->count();
Best Solution
Hello,
Is there a way to count how many h1 tags a given url has? How can I increment $count using this: ?
This prints always 1 even if there are more h1 tags.
Thank you.