[Wylug-help] PHP equiv of my or local variable
Gary Stainburn
gary.stainburn at ringways.co.uk
Wed, 22 Jan 2003 15:34:58 +0000
Hi folks,
is it possible to have local variables within blocks in php, as you can with
perl?
I want $workdate and $workday in the following code snippet to be local to the
block, and neither reference nor infect global $workdate and $workday - while
still referencing globals $year, $month etc.
In Perl I'd symply put 'my' before each of their definitions
if (!$day) {
$workdate=sprintf("%04d-%02d-01",$year,$month);
$workday=return_string("rddate",
"from roster_days where rddate >= '$workdate' limit 1");
if (substr($workday,0,7) == substr($workdate,0,7)) {
$day=substr($workday,8,2);
} else {
$day='01';
}
if ($year == $tyear && $month == $tmonth) {
if ($day < $tday) {
$day=$tday;
}
}
}
--
Gary Stainburn
This email does not contain private or confidential material as it
may be snooped on by interested government parties for unknown
and undisclosed purposes - Regulation of Investigatory Powers Act, 2000