Return to Snippet

Revision: 34143
at October 18, 2010 05:22 by apro2000


Initial Code
$needle = array (1, 'site administrator', 2, 'content manager');

$inside = false;

foreach ($needle as &$value) 
{
    if (in_array($value, array_values($user->roles))) 
    {
     $inside = true;
     break;
    }
}

Initial URL

                                

Initial Description
Drupal snippet

Initial Title
Check for multiple values in array

Initial Tags
php, array, drupal, user

Initial Language
PHP