Could someone please explain why there is a difference between
function foo($a){$blah = $a}.......
foo($CONSTANT);
and
function foo() { $blah = $CONSTANT}.......
foo();
The top method is working for me, the other is not. Specifically the below finds the if statement false:
$this->setsession($user->id,$user->email, ($user->activated == 1) ? STATUS_ACTIVATED : STATUS_NOT_ACTIVATED);
if ($user->act开发者_如何学Pythonivated == 0) { // fail - not activated
$this->error = array('not_activated' => '');
While this one finds it true:
$this->setsession();
if ($user->activated == 0) { // fail - not activated
$this->error = array('not_activated' => '');
Sorry for a poorly written question. The difference is variable scope, I need to pass the variables because the ones I was calling were not able to be referenced.
精彩评论