getting variables from other functions
| From: | Tim Luoma | Date: | Sat, 20 Jul 2002 22:20:39 +0000 |
| Subject: | getting variables from other functions | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-108680@lists.php.net to get a copy of this message | ||
I am just getting started with functions, and have checked the manual and Core PHP Programming but I'm still missing something.
I have two functions in the same PHP file
BTW "$SEARCHDATE" is in this format YYYYMMDD such as 20020720 for July 20th, 2002
function set_search_info ($SEARCHDATE)
{
global $SEARCHYEAR ;
global $SEARCHMONTH ;
global $SEARCHDAY ;
$SEARCHYEAR = substr("$SEARCHDATE", 0,4);
$SEARCHMONTH = substr("$SEARCHDATE", -4,-2);
$SEARCHDAY = substr("$SEARCHDATE", -2);
}
function get_yesterday_info ($YESTERDAY)
{
global $YESTERDAYHUMAN ;
global $YESTERDAYLINK ;
global $PREVIOUSCOMMENT ;
global $LINKBACK ;
$YESTERDAYHUMAN = strftime("%B %d %Y",mktime(0,0,0,$SEARCHMONTH,$SEARCHDAY-1,$SEARCHYEAR));
$YESTERDAYLINK = "<< <a href=\"$SCRIPT?$YESTERDAY\">$YESTERDAYHUMAN</a>";
$PREVIOUSCOMMENT = Exec("/usr/bin/rdjpgcom images/$YESTERDAY.jpg");
$LINKBACK = "yes" ;
}
But $YESTERDAYHUMAN keeps getting set to: November 29 1999 even though $SEARCHYEAR and $SEARCHMONTH and $SEARCHDAY are set properly outside of get_yesterday_info
Thanks
TjL