我想比较两个变量,如:
$user_role = $user_data->roles;
$post_role = get_field('choose_user_role', $child->ID);
他们有:
Array([0] => top_manager [1] => manager)
我尝试使用
$intersection = array_intersect($post_role, $user_role);
但有错误:
警告:array_intersect():参数#1不是数组