Thanks!
Also, I noted that I had the parameters to mktime in the wrong order.
From the Manual:
int mktime ( int hour, int minute, int second, int month, int day, int year [, int is_dst])
Thanks!
Also, I noted that I had the parameters to mktime in the wrong order.
From the Manual:
int mktime ( int hour, int minute, int second, int month, int day, int year [, int is_dst])
Assuming that $DBArray has the names from the database and $NameArray has just the names you can try something like this:
If there is only going to be one maximum occurance of name in either of the arrays (iow. Not wilma=>5 wilma=>2 wilma=>3 in the same array) you can maybe use something like this:
// loop through every name in the DBArray
foreach ($DBArray as $DBname => $DBscore) {
// for every name in the nameArray, see if it matches the current name from the DBArray
foreach ($nameArray as $name => $score) {
if( $DBName == $name ) {
$newScore = $DBScore + $score;
} else {
$newScore = $DBScore;
}
$newArray[$DBName] = $newScore;
}
}
save_newArray_to_DB();
Something like that anyways...
Hope this helps.
//sucks
Hi All,
Checkout this little snippet... There has got to be a better/more elegant solution than this, I've just been staring at it too long to care anymore
Imagine $stamp has the form
YYMMDDHHMMSS so 021109083023 is 8:30:23, 9 Nov 2002
function grab_date($stamp)
{
$retVal = "";
// Split $stamp into characters
$p = preg_split('//', $stamp, -1, PREG_SPLIT_NO_EMPTY);
// combine the characters back together
$yr = $p[0].$p[1];
$mn = $p[2].$p[3];
$dy = $p[4].$p[5];
$h = $p[6].$p[7];
$m = $p[8].$p[9];
$s = $p[10].$p[11];
$ts = mktime ($s,$m,$h,$dy,$mn,$yr);
if($ts != -1) {
$retVal = date ("d F Y (h:m:sa)", $ts);
}
return $retVal;
}