JasonDavis
JasonDavis

Reputation: 48933

Is this a PHP function?

I saw this in a facebook leaked code...

$disabled_warning = ((IS_DEV_SITE || IS_QA_SITE) && is_disabled_user($user));

now unless I am reading it wrong then it is saying that (($var) can be used as a function?

Upvotes: 2

Views: 163

Answers (3)

mauris
mauris

Reputation: 43619

anyway variable functions look something like normal functions except with a dollar sign in front in PHP.

function foo($s){
  echo $s;
}

$bar = 'foo';

$bar('Cool');

Upvotes: 0

Theo.T
Theo.T

Reputation: 9267

This may be naive but $disabled_warning is just storing the Boolean result of the condition.

Upvotes: 0

Kip
Kip

Reputation: 109413

No, it's just setting the value to true or false.

It would be equivalent to this:

if((IS_DEV_SITE || IS_QA_SITE) && is_disabled_user($user))
  $disabled_warning = true;
else
  $disabled_warning = false;

Upvotes: 9

Related Questions