In the code below I'm getting a parse error on this line:
static $controllerForA ll = new McControllerFor All();
why does this give me a parse error? I'm running PHP 4.
function & getController($ callingCode=fal se) {
// 11-27-04 - we want to get the controllerForAl l variable, and we
want to make
// sure that it is always passed by reference. Rather than having
functions do
// something like this:
//
// global $controllerForA ll;
//
// we instead want them to use this function. This adds a wrapper to
the way we
// this variable and thus allows more flexibility in changing the
access later.
// After all, it may not remain in global space in future versions of
the
// software.
// 12-12-04 - we declare controllerForAl l to be static, therefore the
second time
// this function is called it should already exist.
if (is_object($con trollerForAll)) {
if ($callingCode) $controllerForA ll->setCallingCode ($callingCode);
return $controllerForA ll;
} else {
$controllerForA ll = & $GLOBALS["controllerForA ll"];
if (is_object($con trollerForAll)) {
if ($callingCode) $controllerForA ll->setCallingCode ($callingCode);
return $controllerForA ll;
} else {
if (class_exists(" McControllerFor All")) {
static $controllerForA ll = new McControllerFor All();
if (is_object($con trollerForAll)) {
if ($callingCode) $controllerForA ll->setCallingCode ($callingCode);
return $controllerForA ll;
} else {
echo "Awful sorry, we were looking for a software object called
'McControllerFo rAll' but we were unable to find it. The software
really, really needs it to work.";
}
} else {
echo "Awful sorry, we were looking for a software object called
'McControllerFo rAll' but we were unable to find it. The software
really, really needs it to work.";
}
}
}
}
static $controllerForA ll = new McControllerFor All();
why does this give me a parse error? I'm running PHP 4.
function & getController($ callingCode=fal se) {
// 11-27-04 - we want to get the controllerForAl l variable, and we
want to make
// sure that it is always passed by reference. Rather than having
functions do
// something like this:
//
// global $controllerForA ll;
//
// we instead want them to use this function. This adds a wrapper to
the way we
// this variable and thus allows more flexibility in changing the
access later.
// After all, it may not remain in global space in future versions of
the
// software.
// 12-12-04 - we declare controllerForAl l to be static, therefore the
second time
// this function is called it should already exist.
if (is_object($con trollerForAll)) {
if ($callingCode) $controllerForA ll->setCallingCode ($callingCode);
return $controllerForA ll;
} else {
$controllerForA ll = & $GLOBALS["controllerForA ll"];
if (is_object($con trollerForAll)) {
if ($callingCode) $controllerForA ll->setCallingCode ($callingCode);
return $controllerForA ll;
} else {
if (class_exists(" McControllerFor All")) {
static $controllerForA ll = new McControllerFor All();
if (is_object($con trollerForAll)) {
if ($callingCode) $controllerForA ll->setCallingCode ($callingCode);
return $controllerForA ll;
} else {
echo "Awful sorry, we were looking for a software object called
'McControllerFo rAll' but we were unable to find it. The software
really, really needs it to work.";
}
} else {
echo "Awful sorry, we were looking for a software object called
'McControllerFo rAll' but we were unable to find it. The software
really, really needs it to work.";
}
}
}
}
Comment