RE: [PHP] Weird Behavior
| From: | admin at buskirkgraphics dot com | Date: | Wed, 20 Oct 2010 23:02:49 +0000 |
| Subject: | RE: [PHP] Weird Behavior | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-308894@lists.php.net to get a copy of this message | ||
Hmmmmm
I guess the little person inside, just hates the long way of doing
something.
My suggestion
$CD = 1287583899;
$q1s = 1283313600;
$q1e = 1291093200;
$q2s = 1291179600;
$q2e = 1298869200;
$q3s = 1298955600;
$q3e = 1306814400;
$q4s = 1306900800;
$q4e = 1314763200;
for($a=1; $a<=4; $a++)
{
$sSQ = "q".$a."s";
$eSQ = "q".$a."e";
if(($CD >= $$sSQ) && ($CD <= $$eSQ)){ $qCUR = "$a";}
}
echo $qCUR;
The result is 1
Richard L. Buskirk
-----Original Message-----
From: Don Wieland [mailto:donw@dwdataconcepts.com]
Sent: Wednesday, October 20, 2010 10:35 AM
To: php-general@lists.php.net
Subject: [PHP] Weird Behavior
Little help please ;)
$CD = 1287583899
$q1s = 1283313600
$q1e = 1291093200
$q2s = 1291179600
$q2e = 1298869200
$q3s = 1298955600
$q3e = 1306814400
$q4s = 1306900800
$q4e = 1314763200
Why does the following not return the value "1" in the $qCur var
// Current Quarter
if($CD >= $q1s && $CD <= $q1e) $qCur = 1;
if($CD >= $q2s && $CD <= $q2e) $qCur = 2;
if($CD >= $q3s && $CD <= $q3e) $qCur = 3;
if($CD >= $q4s && $CD <= $q4e) $qCur = 4;
it returns "4"
Don Wieland
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php