Display Article Count

I searched the forum and couldn’t see this answered before so here goes… I want to count all the articles belonging to a tag and out put the number.

<?php $tags = $pages->children()->pluck('tags', ',', true); ?>
<ul class="draw">
<?php foreach ($tags as $tag): ?>
<li class="cat"><a href="<?php echo url('works/tag:'.$tag)?>"><?php echo html($tag) ?><span>NUMBER</span></a></li>
<?php endforeach ?>

how do i replace NUMBER with the actual number of articles please?


$number = $pages->children()->filterBy('tags', $tag)->count();

Brilliant… Thank you kind sir!