- array_intersect: documentation ( source)
<?php
global $user_login, $current_user;
$user_info = array(
'nothing',
'subscriber'
);
$roles = array (
'administrator',
'subscriber',
);
if (array_intersect( $roles, $user_info)) {
echo 'success';
} else {
echo 'failure';
}
?>