Using wildcards to 'complete' remainder of filename
<p>Using PHP in Wordpress I have a set of functions that currently return the number of hits for each post for each month and year and further disaggregated by type.  As all this information is currently saved, I would like to return the total hits for each post regardless of type and also disregard time. i.e. provide a running total of hits.</p>

<p>Current functions are:</p>

<pre><code>    function icc_get_view_count($type,$month,$year) {
       global $post;
       if(!isset($month)||($month=='')||!isset($year)||($year=='')) {
       $month = date('m');
       $year = date('Y');
       }
       $post_type = $post-&gt;post_type;
       if($post_type == 'partners') {
$post-&gt;ID;
$current_views = get_post_meta($post-&gt;ID, "icc_views_".$type."_".$month."_".$year, true);
if(!isset($current_views) OR empty($current_views) OR !is_numeric($current_views) ) {
     $current_views = 0;
}
}

return $current_views;
}

function icc_show_views($type,$month,$year) {
   global $post;
   if(!isset($month)||($month=='')||!isset($year)||($year=='')) {
   $month = date('m');
   $year = date('Y');
   }

   $post_type = $post-&gt;post_type;
   if($post_type == 'partners') {
echo $current_views = icc_get_view_count($type,$month,$year);
   }
}
</code></pre>

<p>which is then called by:</p>

<pre><code>   &lt;?php icc_show_views('single', $month, $year); ?&gt;
</code></pre>

<p>All the posts start with 'icc_views_' and then are appended with 'type', 'month' and 'year'. I have tried using glob()</p>

<pre><code>    $current_views = get_post_meta($post-&gt;ID, glob("icc_views_*"), true);
</code></pre>

<p>to complete the filename so the type, month and year are all returned regardless but cannot seem to get this to work.</p>

<p>Any pointers would be greatly appreciated</p>
