DaveC426913
Programmer
What does this syntax mean:
function foo($bar=0) {
...
}
I don't understand the parameter. Is it equivalent to an assignment? as in:
function foo() {
$bar=0;
...
}
or perhaps, an optional param?:
function foo($bar) {
if (is_null($bar)){
bar = 0;
}
...
}
Here it is in context. The actual variable is $shift (in case that's a reserved variable or something):
$newCal->displayMonth($mes);
...
function displayMonth($shift=0) {
...
$firstday_month_ts = mktime(0,0,0,date("n")+$shift,1,date("Y")); // first day of the month
$lastday_month_ts = mktime(0,0,0,date("n")+$shift+1,0,date("Y")); // last day of the month
...
if ($shift==0 && $today_ts==$day_i_ts) {
}
#$mes would be an integer representing a month
function foo($bar=0) {
...
}
I don't understand the parameter. Is it equivalent to an assignment? as in:
function foo() {
$bar=0;
...
}
or perhaps, an optional param?:
function foo($bar) {
if (is_null($bar)){
bar = 0;
}
...
}
Here it is in context. The actual variable is $shift (in case that's a reserved variable or something):
$newCal->displayMonth($mes);
...
function displayMonth($shift=0) {
...
$firstday_month_ts = mktime(0,0,0,date("n")+$shift,1,date("Y")); // first day of the month
$lastday_month_ts = mktime(0,0,0,date("n")+$shift+1,0,date("Y")); // last day of the month
...
if ($shift==0 && $today_ts==$day_i_ts) {
}
#$mes would be an integer representing a month