Skip to main content
replaced http://us2.php.net with https://www.php.net
Source Link

You can use array_key_exists()array_key_exists() to do this:

$rid = 42;

if (array_key_exists($rid, $user->roles)) {
  // Do stuff
}

If you just want an array of RIDs, you can use array_keys()array_keys():

$rids = array_keys($user->roles);

You can use array_key_exists() to do this:

$rid = 42;

if (array_key_exists($rid, $user->roles)) {
  // Do stuff
}

If you just want an array of RIDs, you can use array_keys():

$rids = array_keys($user->roles);

You can use array_key_exists() to do this:

$rid = 42;

if (array_key_exists($rid, $user->roles)) {
  // Do stuff
}

If you just want an array of RIDs, you can use array_keys():

$rids = array_keys($user->roles);
Post Made Community Wiki by avpaderno
Source Link
user7
user7

You can use array_key_exists() to do this:

$rid = 42;

if (array_key_exists($rid, $user->roles)) {
  // Do stuff
}

If you just want an array of RIDs, you can use array_keys():

$rids = array_keys($user->roles);