Skip to content

Instantly share code, notes, and snippets.

@siddartha
Created December 28, 2016 11:20
Show Gist options
  • Save siddartha/a7cbc01fa96cd7a940d5997237d91caf to your computer and use it in GitHub Desktop.
Save siddartha/a7cbc01fa96cd7a940d5997237d91caf to your computer and use it in GitHub Desktop.
<?php
$today = date("Y-m-d");
$month = date("Y-m"); $mpattern = '/^'.$month.'/';
$yesterday = date('Y-m-d', strtotime("1 day ago" ));
foreach ($metrics_global as $k => $row) {
// DEBUG echo $k."-(".$row['met_date']." / ".$row['earn'].")<br />";
$total+= $row['earn'];
if (in_array($yesterday, $row)) {$hier = $row['earn'];}
if ($k>22){ $last7days+=$row['earn'];}
if ($k<30){ $last30days+=$row['earn'];}
if (preg_match ($mpattern, $row['met_date'], $m)) {$thismonth+= $row['earn'];}
}
?>
@siddartham
Copy link

testing comments for gist

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment